Tag Info

New answers tagged

5

HDF5 does not directly support complex numbers. Programs that do seem to be able to export complex numbers (like armadillo) to HDF5 will in reality split them into real and imaginary part and use their own non-standard convention for storing these. This means that while they can sometimes read back their own data, there is no compatibility between ...


3

The table in the screenshot was produced by TableForm.


3

The closest thing to an R data.frame in Mathematica is a DataSet; http://reference.wolfram.com/language/ref/Dataset.html


1

Sometimes, the file size and number of frames of a bvh file can be very large, one might skip every other frames to reduce the file size and cut half of the number of frames. The example below, has 3602 frames and 2,559KB in size, one can cut it into half with the following codes: srcFile = "https://www.dropbox.com/s/j4k5f4vfqb592tw/Dance01.bvh?dl=1"; ...


2

Assuming that the example XML shown is representative, then we can exploit the fact the write and id attribute names are unambiguous within tekst elements: Cases[test , XMLElement["tekst", a_, c_] :> Sequence["write" /. a, Cases[c, ("id" -> i_) :> i, -1]] , -1 ] (* { "test1", {"AA-504771", "BB-59362", "CC-59362"}, "test2", {"AA-20210", ...


3

In this case what you want is simple/regular enough that you can define the XMLElement etc. as functions that return what you want inside a Block: Block[{XMLObject, XMLElement}, XMLObject["Document"] = #2 &; XMLElement["tekst", {"write" -> t_}, data_] := {t, Sequence @@ data}; XMLElement["lu", attr_, data_] := "id" /. attr; XMLElement[tag_, ...


2

The following can be used to extract the identifiers used in a given test case, which matches the "write" attribute of an individual XMLElement. Note that the attribute names "write" and "id" are hard-coded, which is not ideal. GetIdentifiers[data_, test_String] := Module[{elem, attr}, (*find test case*) elem = Cases[data, XMLElement[___, {___, ...


3

This seems to be a normal way to extract the data:- xml = XMLObject["Document"][{XMLObject["Declaration"] ["Version" -> "1.0", "Encoding" -> "UTF-8", "Standalone" -> "yes"]}, XMLElement["file", {"name" -> "filename.xml"}, {XMLElement["tekst", {"write" -> "test1"}, {XMLElement["relation", {"type" -> "co-synonyms", ...


1

A little integer and string hacking generates all and only the names required. Data = Table[s = ToString[j]; Import["C:\\Dropbox\\Sims\\datafile." <> StringTake[s, 2] <> "." <> StringDrop[s, 2] <> ".out", "Data"], {j, 200000, 300000, 1000}]


1

You could also use: data= Import["c:\\dropbox\\sims\\datafile.20." <> IntegerString[#, 10, 4] <> ".out" ]& /@ Range[1000]


3

You can use FileNames to get list of .out files data = Import[#, "Data"] &/@ FileNames["datafile.*.out", "C:\\Dropbox\\Sims\\", 1]


6

If you're using Windows you can use my MathMF package (see here). It is designed for frame-by-frame import and export of video files. The code would then look something like this: frames = FileNames["*.JPG", "C:\\Users\\Simon\\Desktop\\test images"]; << MathMF` MFInitSinkWriter["C:\\Users\\Simon\\Desktop\\test.wmv", 300, 300] ...


1

Here is a way that works for me (V9) by altering the normal pipeline of the Import/Export Framework. The usual disclaimer about using undocumented functionality applies. (* Setup *) ls55ImportSPDirectory[dir_String, OptionsPattern[]] := Module[{fname = dir <> "a.png", ret}, If[FileExistsQ@fname, ret = "File " <> fname <> " ...



Top 50 recent answers are included