Hot answers tagged

10

Proper Input of file and checking the list Make sure that the variable list does contain your file inputs and make sure that Mathematica correctly understands your numbers. For this you might try: list = SemanticImport[ "myfile.txt", "Number", "List" ] or using ReadList you might try: list = ReadList[ "myfile.txt", "Number" ] Then check whether there ...


6

This is what I'd do: You say most of the pixels are dark, and thus uninteresting, but some of them are bright. So I'd start by summing all images up to find the "bad" pixels: files = FileNames[ "*.png"]; totalBrightness = 0.0; Monitor[Do[ totalBrightness = ImageData[Import[f]] + totalBrightness, {f, files}], f]; meanBrightness = ...


6

Here is the answer from Wolfram Technical Support 12-bit TIFF files are not currently supported by Mathematica. Our developers are interested in supporting this format, however, and I have filed a suggestion on your behalf. I have also included your contact information so that you can be notified if this gets implemented.


6

Another way is to use the MATLink package (see Calling MATLAB from Mathematica), if you have Matlab installed. (* See http://matlink.org for installation *) Needs["MATLink`"]; OpenMATLAB[] test = MScript["test", " %******************************************** clear M=[ % Frequence Amplitude Phase 10 9.359000E+0 1.340000E+0; ...


5

I don't see why one would expect that two so dissimilar program languages with a completely different syntax and philosophy like MatLAB and Mathematica could use each others programs. To get your plot you really have to code in Mathematica (or Wolfram Language, as we're supposed to call it nowadays): First, I copy the data as a string and let it interpret ...


5

It is Compress\Uncompress that is throwing a wrench in things. Why do you need that anyway? I'm sure you aren't getting much compression. This works. Export["test.txt", Encrypt["my password", img], "Text"] Decrypt["my password", ToExpression@Import["test.txt", "Text"]] You don't need to export to see that the compression is an issue, just do this: ...


5

If you're command line friendly, one possible workaround is to use imagemagick or one of the various libtiff command line tools to turn your image into 16-bit, viz.--- Import["12_bit.tif"] (* $Failed *) Run["/usr/local/bin/convert 12_bit.tif -depth 16 16_bit.tif"] (* 0 *) Import["16_bit.tif"] (* sweet sweet success *) On the Mac, I have imagemagick and ...


5

george2079's answer works great for ignoring comment lines, but it uses Import to read in the whole file at once. Sometimes you have really large files that you can't Import in one go, you have to read them line by line. Of course, for files where you can use Import, that will be faster because you are applying the test to the one big string instead of to ...


4

The data FileNames["*.png"] (* {"image_01.png", "image_02.png", "image_03.png", \ "image_04.png", "image_05.png", "image_06.png", "image_07.png", \ "image_08.png", "image_09.png", "image_10.png"} *) All at once If there are no memory constraints, you can load all in a single array (read below for other cases). data = ImageData[Import[#], "Byte"] & ...


3

Here are some approaches with slightly modified versions of your input CSV file. If you are looking for an efficient way to read the data, the input data should be as friendly as possible to MMA. However in the last example, I will give one possible way to process your original data. 1. ReadList with formats With this approach, the most problematic in ...


3

I am only a beginner at Mathematica but I notice that Max is left unevaluated if given non numerical data types: I recommend sampling your data: RandomSample[lista,10} and applying the Head[] function to a few elements which returns the data type


2

I know a very awkward way to make an Input cell which behaves the way you are looking for. It has different editing properties. I came across such cells when importing notebooks from very long ago. They were from the mid 1990's either Mathematica 3 or Mathematica 4 and they had editing properties, which I still miss very much today. Here I show you a ...


2

As long as you are using ReadList to read in the entire file, and then acting on each line, you may as well just feed the result of ReadLine into ImportString. test = ImportString[ StringJoin[ Riffle[ReadList["shoes_revenue.csv", String], "\n"] ], "CSV"]; // AbsoluteTiming (*{2.7918, Null}*) which is marginally faster than this answer ...


2

If you need to do computation on the graph, and/or your graph is very large- working with a SparseArray and an AdjacencyGraph may prove the most beneficial. Here is a random list which can resemble your data: randomVals = Table[{RandomInteger[10], RandomInteger[20]}, 100]; Now we obtain a list of all the values in the list: keys = ...


1

Well, after reading the comment by george2079, and removing the 'é' character, the import command still returned the same error. So, I decided to remove also the '-' from the 'TSA - Cryer and Chan' folder, and it worked.


1

Try Import with the following argument: ImportString["10533 \"MENDOZAT \" 115.0000 : 1 1.00000 10533 \"MENDOZAT \" 115.0000 : 2 1.00000 10533 \"MENDOZAT \" 115.0000 : 3 1.00000", "Table", Delimiter -> "\t"]


1

Using the "Byte" format when importing and exporting seems to work. In[1]:= CreateArchive["input", "input.zip"] Out[1]= "C:\\Users\\Andy\\Documents\\input.zip" In[2]:= enc = Encrypt["password", Import["input.zip", "Byte"]] Out[2]= EncryptedObject[<|Data -> ByteArray[< 320 >], InitializationVector -> ByteArray[< 16 >], ...


1

I am not sure what exactly you are looking for, but you could apply ToExpression to those columns that should be Integers instead of Strings: Head@ToExpression["1234"] (* Integer *) Similarly, you can combine the last two columns, drop the Dollar symbol and convert to integer: ToExpression@StringDrop["$2" <> "843", 1] (*2843 *)


1

Recently issues related to SocialMediaData(for services like Twitter/Facebook) has been fixed with new paclet release.



Only top voted, non community-wiki answers of a minimum length are eligible