New answers tagged

0

THIS IS AN EXTENDED COMMENT RATHER THAN AN ANSWER. $Version (* "10.4.1 for Mac OS X x86 (64-bit) (April 11, 2016)" *) plt = Plot[Sin[x], {x, 0, 2 Pi}] Export["Desktop/myfile.eps", plt]; plt2 = Import["Desktop/myfile.eps"] The tick labels are missing although they appear when the eps file is opened in another application (e.g., Preview). ...


2

Okay, so this is what it looks like with standard coloring of the residues: Import["ExampleData/1PPT.pdb", ColorFunction -> "Residue"] But now, if we want to change the residue colors, we need to change the value of a certain internal color list called Graphics`MoleculePlotDump`residueColorRules residuelist = {"Gly", "Pro", "Ser", "Gln", "Pro", ...


0

I can propose a more general solution. It is based on regular expressions (or here, string patterns). The idea is to look for the shortest strings in the file that begins with double-quote, ends with double quotes, does not contain any double quote, but can contain one or many EndOfLine. As it is a CSV, there are comma before the double-quote (thus, this ...


1

You need to evaluate the cells. You can evaluate the current cell by using "Shift+Enter". For an introduction to evaluation, here are some helpful references: Interactive Usage page of The Wolfram Language: Fast Introduction for Programmers. Practicalities of using the Wolfram Language from An Elementary Introduction to the Wolfram Language by Stephen ...


3

If you have flexibility in choosing your txt file data format, then you can work backwards. Start by constructing the objects you want in Mathematica. For example, a list of vectors: testObject=Tuples[{0, 1}, 3] (*{{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1},...,{1, 1, 1}}*) Then export this into a text file with a convenient format (such as CSV): ...


2

This will split the text into chunks and plot them as molecular plots, imglist = ImportString[ExportString[#, "Table"], "XYZ"] & /@ Partition[ StringSplit[ Import["http://comsics.usm.my/tlyoon/teaching/ZCE111_1516SEM2/\ data/NP3D.xyz", "Text"], "\n"], 12]; But, those carbon atoms sure are close together.... imglist[[405]] Maybe the ...


5

It does not work because of different data elements, compare Import["ExampleData/caffeine.xyz"] with data structure and your data structure: but change it to: with Import["NP3D.xyz"] you will get: full data looks like You can make an animation with these snapshots: data1 = StringRiffle[#, "\n"] & /@ ...


7

The following should be fast enough: myList = ReadList["infile.txt", Number, RecordLists -> True]; // AbsoluteTiming {4.64517, Null}


2

Using NETLink we can come close to your specs. Note that passworded.xlsx is the password protected file, the password is "peter" and notPassworded.xlsx is the temp copy of a non-protected file. Needs["NETLink`"] LoadNETType["System.GC"]; excel = CreateCOMObject["Excel.Application"]; excel[Visible] = True; workbook = excel@Workbooks@ ...


3

This seems to work: URLFetch["https://docs.google.com/document/export?format=txt&\ id=17m1JfjEbrna7e9INZv-FXZQ9yQJd8d1Uu2LFEPyT_ZI&token=\ AC4w5VhkHSfLIe2xvAUWQC9XHb1lAmM7Xw%3A1460476462625"] (* "When the soil were finally depleted of all nutrients, we \ realised that paper isn't edible. Or is it? Now all paper is \ digestible, we eat the wrapping ...


7

I know this is an old question, but I ran into this problem myself. The permanent solution for me was to alter the settings of JLink directly. As for most commenters too, increasing the heap-space by giving commandline options to ReinstallJava and friends didn't work. Specifically, I tried to increase the heap-space by specifying the complete CommandLine ...


5

JLink` Here is a solution that uses JLink` to leverage Java's support of XML Schema: Needs["JLink`"] InstallJava[]; LoadJavaClass["javax.xml.validation.SchemaFactory", AllowShortContext -> False]; LoadJavaClass["javax.xml.XMLConstants", AllowShortContext -> False]; validateXml[xsd_String, xml_String] := JavaBlock @ Module[{factory, xsdSource, ...


1

What follows is a variation on a previous answer To exclude row 4 from comma-delimited data: dataGood = Flatten[#, 1] & @(Import["/path/to/myfile.txt",{"Data", #, {All}}] & /@ {Range[3], Range[5, 6]}); and dataGood // TableForm For comparison: dataAll = Import["/path/to/myfile.txt", {"Data", {All}, {All}}]; dataAll // TableForm ...


3

As mentioned in the comments to your question, you just Import the whole data and then manipulate it afterwards. This is (I believe) a very transparent way to achieve the end result that you want and also illustrates why you should not use an "advanced" Import: Let's produce some sample data dim = 100; data = RandomReal[{-1, 1}, {dim, 3}]; ...


2

refering to Can I read Chinese characters with ReadList correctly? here is the solution: first try FromCharacterCode[ ToCharacterCode[ ReadList["...file.txt", Record, 1]], #] & /@ $CharacterEncodings read the output then select the one of $CharacterEncodings which correctly translated the characters (which may depend on your systems or Mathematica ...


2

I checked it with 64-bit OS and it worked. Apparently It only work in 64-bit version of windows (7).


2

Let's say this is your CSV file, http://i.imgur.com/8giNhRb.jpg, penguins http://i.imgur.com/ZQXCY7c.jpg, penguins http://i.imgur.com/bQ6lqNU.jpg, penguins http://i.imgur.com/lxzTgH9.jpg, penguins http://i.imgur.com/eHdgXnt.jpg, penguins http://i.imgur.com/Bmy54vW.jpg, penguins http://i.imgur.com/MtzebxR.jpg, penguins http://i.imgur.com/pkDhR1w.jpg, ...


6

You can temporarily change CellContext of the notebook with SetOptions or CurrentValue but if the notebook isn't opened yet, this is faster: Module[{path, nb} , path = (*path*); nb = NotebookOpen[ path, CellContext -> "Global`", Visible -> False]; NotebookEvaluate[nb, InsertResults -> False]; NotebookClose[nb] ] You can use ...


0

out of curiosity I worked out the encoding, at least partly. It takes the last 4 bits of the first byte and the last 6 bits of the remaining two from each triplet, so we can directly decode like this: cdecode[s_String] := FromCharacterCode@FromDigits[ Join @@ MapThread[IntegerDigits[FromDigits[#1, 16], 2][[#2 ;;]] &, {StringTake[#,Array[{3 ...


3

As the @george2079 's suggetion,I post my solution from a friend as an answer,but I'm sure there are more better method can do this.I accept myself answer just for reader.If anyone have post better solution,I'll change the acceptance. $Version "10.3.1 for Microsoft Windows (64-bit) (December 21, 2015)" string = First@Import["file address"]; Rule @@@ ...


1

Here is the plain text of the VCF file from your link: BEGIN:VCARD VERSION:2.1 N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=E6=B5=8B=E8=AF=95;;;; FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=E6=B5=8B=E8=AF=95 TEL;HOME:12345 678 9 END:VCARD Given this, Mathematica's answer is not surprising. Perhaps the odd characters are representatives of a font that is not ...


0

It would have been best if you post the TIFF file (upload it somewhere). Without it, my best guess is this: data = Import["file.tiff", "Data"] will import the integers stored in the TIFF. These may have various ranges depending of the type of TIFF file. For an 8-bit one, you'll get values between 0..255, for a 16-bit one between 0..65535, etc. data only ...



Top 50 recent answers are included