Tag Info

New answers tagged

0

I reported this to Wolfram Research and it has been classed as a bug. No word on a fix.


11

I was stuck for a while with a not really acceptable result, but then @belisarius posted his answer and I was able to refine my code with the usage of his findCurvedPath2 function. So I am able to post my solution to the problem. First, import and process the image: img = Binarize@Import["http://i.stack.imgur.com/Z7rKJ.jpg", "JPEG"]; imgc = ...


20

The following is something I made while trying to solve another (similar) problem (* FindCurvedPath Replacement*) ClearAll[findCurvedPath2, findClosedPath2]; findClosedPath2[inptList_] := Append[#, #[[1]]] &@findCurvedPath2[inptList] findCurvedPath2[inptList_] := Block[{$RecursionLimit = Round[2.1 Length@inptList], ...


12

Since your image is binary, you can just pick out the top-most point in each column of the data matrix: img = Import["http://i.stack.imgur.com/Z7rKJ.jpg"]; dat = Transpose[ImageData@EdgeDetect[img]]; {c, r} = Dimensions[dat]; points = r - Min[Flatten@Position[dat[[#]], 1]] & /@ Range[c]; np = Interpolation[points, InterpolationOrder -> 1]; ...


1

Does this answer you first concern? Manipulate[ t = Quiet[ Check[Import[url], {{"error, please provide a valid link"}}]]; Pane[TableForm[t], {Full, 300}, Scrollbars -> True, AppearanceElements -> None] , {{url, ""}, InputField[#, String, ImageSize -> {500, 35}] &}, {t, None} ] You can achieve this in many ways, the question ...


6

To long for a comment: I think there are multiple typos (I hope) in docs for Get. This will work Get["Test`", Path -> {NotebookDirectory[]}] even without SetDirectory and this will work automatically too: SetDirectory @ NotebookDirectory[]; << Test` So the difference is in ` More accurate in description is tutorial/FilesForPackages ...


0

Google Mathematica AES and get OLD Mathematica library claiming to implement AES I don't know whether that still works or not, but it might be a start.


3

The Base64 string you provided as an example is not an encoding of a gzip stream (RFC 1952). It is an encoding of a zlib stream (RFC 1950). For background, those are different wrappers around the raw "deflate" compressed data format (RFC 1951), where the wrappers are headers and trailers proving information on the compressed data and integrity check ...


0

I don't have 50 reputation points so I'm submitting this as an answer when it is really a comment, a small addition. After doing the first approach given by WReach, Wrap the result of your evaluation between theses two brackets -->"Grid[]" and add "Grid[ ,Frame->All]". Enjoy!


1

That's a funny bug that I would report to Wolfram. I managed to similarly break my environment by trying to answer this :-p. However, functionality is restored for the current session if you run Get[FindFile["JSONTools`"]] Unfortunately I seem to need to run this whenever I restart the kernel.


2

This times about 65% higher than Leonid's on my machine. But maybe a more naive answer might be useful to some. Module[{rBytes}, (* Returns the next numbers or $Failed *) read[str_InputStream] := rBytes[str, BinaryRead@str]; rBytes[str_, n_Integer] := BinaryReadList[str, "Byte", n]; rBytes[_, EndOfFile] := $Failed; ] (* Some usability defs *) ...


3

General Here is my suggestion: if you have enough RAM (which may well be the case, given that your files are not in GB range), it will likely be faster to load the file into memory at once, and then split into groups of bytes. Note however, that since at the moment there isn't a top-level byte array representation in Mathematica which would be easy to work ...


2

Try this: names = FileNames["*.txt"]; Export[StringInsert[#, "_output", -5], Sort /@ Import[#, "Table"][[2 ;;, 2 ;;]], "TSV"] & /@ names


2

As noted in my comment, replacing the third line of code by t1 = Table[t[[i]], {i, 2, tp}]; allows the code to run. With made-up data t = {4, {2, 3, 4}, {5, 6, 7}, {4, 3, 2}, {7, 6, 5}}; it produces Is this what you had in mind? Further progress requires actual data. Update Now that the data is available, I see that it does not have a ...


0

Suppose graphs is your list of graphs. names = Table["graph" <> ToString@i <> ".gml", {i, Length@graphs}] MapThread[Export, {names, graphs}]


2

newstr = StringReplace[str, Rule @@@ {{", ", ","}, {"{", " "}, {"}", " "}, {"[", "{"}, {"]", "}"}}]; ToExpression@ StringCases[newstr, var : Except[" "] .. ~~ "=" ~~ val : Except[" "] .. -> {var, val}] returns {{n, 7}, {c, {31.233, 36.959, 40.813, 42.268, 36.19, 31.346, 24.133, 15.885, 17.567, 18.853, 25.427, 32.991, 42.495, 43.548, 41.307, ...


0

This is a different approach: StringCases[ str, StartOfString ~~ type : Except["{"] .. ~~ "{" ~~ "n=" ~~ n : DigitCharacter ~~ WhitespaceCharacter .. ~~ vectors : (LetterCharacter .. ~~ "=[" ~~ Except["]"] .. ~~ "]" ~~ WhitespaceCharacter ...) .. ~~ ___ :> {type, n, StringCases[vectors, a : LetterCharacter .. ...



Top 50 recent answers are included