Tag Info

New answers tagged

1

Try the following: (* Import your data as tab-separated values; extra "" will be included *) Import["c:\\Users\\Marco\\Desktop\\Sandbox\\rawdata.txt", "TSV"]; Flatten[%]; (* remove the "" caused by the extra tabs in your data file *) DeleteCases[%, ""]; (* Reshape your data into an array with your required dimensions *) ArrayReshape[%, {308, 508}]; (* ...


3

Because the data in the text file has one column, importing using the "Table" format produces a nested N × 1 array, where N is the number of lines in the file. Instead, use the "List" import format, and you will get a one-dimensional array: Import["D:/Data/Mathematica/Convert_data/rawdata.txt", "List"] should give {1.59867, 1.57057, 1.60027, 1.51327, ...


0

Here is a quick answer (based on @GuessWhoItIs's comment) for a basic rotation: STLdata = Import["MyFile.stl", "GraphicsComplex"]; RotatedSTL = Graphics3D[ GeometricTransformation[STLdata, RotationTransform[30 Degree, {1, 1, 1}]], Axes -> True] Export["MyFileRotated.stl", RotatedSTL, {"STL","BinaryFormat" -> False}]


4

This isn't a correct CSV file looking at it in Google Docs: In the second column one can see a complete Mathematica list as a string. The downloaded version has some issues too, so I read it in as a binary file and process it line by line. fp = OpenRead["C:\\Users\\XPS15-Sjoerd\\Downloads\\rutas.csv", BinaryFormat -> True]; routes = Reap[ While[ ...


3

The second number has too many digits to fit into machine precision therefore it is automatically cast to arbitrary precision. I do not believe this is specifically related to importing, e.g.: $MachinePrecision a = 1.00000000000001; b = 2.1234567890123456789; c = 3.01; Precision /@ {a, b, c} 15.9546 {MachinePrecision, 19.327, MachinePrecision} Now ...


5

Here are two ways. SemanticInterpretation is sort of fun but extremely slow: SemanticInterpretation["{26.2417,-98.432},{26.2407,-98.4247}", List[_, _] ..] Fixing up your data to fit Yves Klett's suggestion is much faster: ToExpression["{" <> "{26.2417,-98.432},{26.2407,-98.4247}" <> "}"] Both yield (* {{26.2417`, -98.432`}, {26.2407`, ...


1

Without having the .csv file to work on, as guess who it is said, this should get you where your going. cord=Import["mydrive/file.csv","Data"]//ToExpression Again Please give a sample of what the data is in the .csv file.


4

The default type is an unsigned integer. You need to specify a suitable type, eg: testList = {1, 2, 3, -4}; file = "test1"; BinaryWrite[file, testList, "Integer8"]; BinaryReadList[file, "Integer8"] Close[file]; Note the read needs to know the type as well. See BinaryRead for the list of types. (Integer8 is only good for values in the range -128 to 127 of ...


2

I have used ReadList command, MyList = ReadList[file]; And now, the result is right, MyList {{k0,{a0,b0,c0},{e0,f0,g0}} {k1,{a1,b1,c1},{e1,f1,g1}}} Your information has helped me to find a simple solution. Regards.


1

MyList = Import[file, "Words"]


0

You got unbalanced brackets, that is unexpected. The expected result is {{"{k0,{a0,b0,c0},{e0,f0,g0}}"}, {"{k1,{a1,b1,c1},{e1,f1,g1}}"}} To convert this list of string to list expression is: ToExpression /@ Flatten[{{"{k0,{a0,b0,c0},{e0,f0,g0}}"}, {"{k1,{a1,b1,c1},{e1,f1,g1}}"}}] (*{{k0, {a0, b0, c0}, {e0, f0, g0}}, {k1, {a1, b1, c1}, {e1, f1, g1}}}*) ...


7

You can use Import directly as follows: Import["MVI_9855-183.mp4", {"AVI", "ImageList", Range[1, 110, 20]}] This will import one frame every 20, between the first and 100th, and return them as a list of pictures. As you can see above, at least in the case of the mp4 files I have at hand I was able to "convince" Mathematica to import them directly by ...



Top 50 recent answers are included