Tag Info

Hot answers tagged

9

This will download the titles of all articles that transclude the Persondata template, if that's what you're trying to do. Flatten@NestWhileList[ Import["http://en.wikipedia.org/w/api.php?action=query&list=\ embeddedin&eititle=Template:Persondata&format=json&eilimit=500" <> If[Length@# > 1, "&eicontinue=" <> ...


5

This seems to be a Java heap space error. I encounter this quite often when importing large Excel sheets, though I get a different error message: Import::nojmem. The help page for this error contains instructions that may be useful for you as well. Basically, you increase heap space using the following commands: Needs["JLink`"] ReinstallJava[JVMArguments ...


5

This is a bit of a shot in the dark but this general approach may work with a bit of tweaking. (note another edit fix..) dat = Table[i, {i, 5}] rnus = ("nu" <> ToString[#] -> 0.5 + # & /@ (Range[5])) BinaryWrite[g = OpenWrite["test.fits", BinaryFormat -> True], ExportString[{"Data" -> dat, "Metadata" -> Join[rnus, ...


4

If this device support NI-VISA (as I understood from your reference to LabView), then you can use following way: Install the VISA engine (available at NI web-site) Use following code. Needs["NETLink`"] lib = LoadCOMTypeLibrary[ "C:\\Program Files (x86)\\IVI \Foundation\\VISA\\VisaCom\\GlobMgr.dll"] mgr = NETNew["Ivi.Visa.Interop.ResourceManagerClass"]; ...


3

I put here a function built from @george2079's answer as it may be of interest to other people. Clear[FitsExport]; FitsExport[fname_, dats_, descriptions__] := Module[{g}, BinaryWrite[g = OpenWrite[fname, BinaryFormat -> True], ExportString[{"Data" -> dats[[1]], "Metadata" -> {"Field" -> descriptions[[1]], "NEXTEND" -> 1}}, ...


2

This reads your example: a crude start anyway, i'm not parsing the headers just showing them as strings. f = OpenRead["test.fits", BinaryFormat -> True]; First@Last@ Reap[ While[ (Sow[ StringJoin@BinaryRead[f, Table["Character8", {80}]]] != StringJoin["END", Table[" ", {77}]])] ] Print["lines read = ", nh = Length[%]] ...


2

Update I use Mr.Wizard dynamicPartition (code included below). dat1 = Range@5; dat2 = Range@6; metadata = { "MetaInfo" -> "MyData", "MyValue" -> ToString[Dimensions /@ {dat1, dat2}] }; Export["foo.fits", {"Data" -> Flatten@{dat1, dat2}, "Metadata" -> metadata}, "Rules"]; Example 1: data = Import["1Example.fits", "RawData"] (* ...


2

The website loads the data via Ajax and then inserts it into the HTML code. It's much easier if you import from the source of the data: data = Import["http://ultrasignup.com/service/events.svc/history/Troy/Siemers", "JSON"]; You now have all data that is shown on that page in a neat list of rules.


1

input = StringSplit[#, "\n"] & /@ StringSplit[Import["c:\\Users\\Rasher\\Documents\\testtext.txt"], "^"] title = input[[All, 1]] text = input[[All, 2 ;;]] Titles in titles, obviously, with indicator stripped. Text in corresponding text element, as a list with each line of text an element.


1

You can do the following: data = ReadList["filename.ext", {Word, Word, Word}]; Then a little post processing: ToExpression@StringReplace[#, {"e" -> "*^"}] & /@ data



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