Tag Info

New answers tagged

3

aA = {1, 2, 3}; Export["mfile2.xls", {"A" -> List/@ aA}] or Export["mfile2b.xls", {"A" -> Transpose@{aA}}] see also this related Q/A: Problem exporting lists to Excel


1

Export["C:\\YourPath\\test.xlsx", List /@ {1, 2, 3}]


2

Even though I don't see it in the documentation, you can use All when specifying what elements you want to import. So for an example Excel spreadsheet: We can import the 2nd and 5th elements from every row on the first sheet as such: Import["pathtoxlsx.xlsx", {"Data", 1, All, {2, 5}}] {{0.612328, 0.325049}, {0.909502, 0.206016}, {0.531286, ...


0

thelist=ReadList["/tmp/foo", "Number"] Partition[Drop[thelist, 1], 2] Will give you a list of re/im pairs (I just tried it, it works).


1

This most likely will be closed as duplicate, as pointed out by @Teake_Nutma, this has been answered already here. In the meantime, the trick basically is: To save: DumpSave["state.mx", "Global`"] To load: Get["state.mx"]


6

For the first case, the following should work: Mean /@ GatherBy[dat, First] OR Mean /@ GroupBy[dat, First] The second case gives an association with index as Keys For the maximum by second value, try: MaximalBy[#, #[[2]] &] & /@ GatherBy[dat, First] OR MaximalBy[#, #[[2]] &] & /@ GroupBy[dat, First]


2

Your file seems to be corrupt, there is one extra byte in the header section. Open in a binary clean text editor, search for "uK^2" and delete exactly one space following the 2. The file can then be read by this: (adapted from link in comment) f = OpenRead["test.fits", BinaryFormat -> True]; parsehead[hh_] := (metadat[#[[1]]] = #[[2]]; #) & ...


1

As you requested in your edit, @Mr.Wizard's answer shows how to perform listwise deletion (= corr in Stata). An alternative is to perform pairwise deletion (= pwcorr). In a comment above you note that some variables have many missing values; in my opinion this indicates you may want to consider pairwise deletion so that you are not throwing out a lot of ...


5

Here's another approach : (* divide polygon pts to clean up artificials when polygon has holes *) FindContourBreaks[pts_List] := Module[{i, lines, breaks = {}}, lines = {pts[[#[[1]]]], pts[[#[[2]]]]} & /@ Partition[RotateLeft[Flatten[{#, #} & /@ Range[Length[pts]], 1]], 2]; Position[lines, Alternatives @@ ...


3

Hopefully I don't misunderstand but I think this will be of help: SeedRandom[0] d1 = {Range[#], RandomInteger[99, #], RandomInteger[1, #]}\[Transpose] &[20] {{1, 83, 1}, {2, 66, 1}, {3, 4, 0}, {4, 21, 0}, {5, 71, 0}, {6, 67, 1}, {7, 16, 1}, {8, 67, 0}, {9, 76, 1}, {10, 28, 1}, {11, 21, 1}, {12, 43, 1}, {13, 17, 0}, {14, 46, 0}, {15, 53, 0}, ...


8

Take a look at this. Let's generate some data with missing entries: data = Table[9 k + RandomInteger[9, 10], {k, 10}] /. Thread[RandomInteger[99, 5] -> Missing[]]; data // TableForm Build TemporalData object and select replacement method for missing points: td = TemporalData[data, {Range[10]}, MissingDataMethod -> {"Interpolation", ...


7

The best tool to work with the SEED format would be IRIS' own rdseed program. It might be possible to use Jrdseed with JLink and Mathematica, but I have not tried this. Typically SEED files are converted to other convenient formats for data processing, of which the SAC (Seismic Analysis Code) format is the most common one. Implementation: The following is ...



Top 50 recent answers are included