DMUG-Archiv 2009

Frühere   Chronologischer Index   Spätere
Vorherige   Thematischer Index   Nächste

Re: segmentierte Datei einlesen

Hallo Christian,

falls feststeht, dass die Untermatrizen stets drei Vektoren enthalten

In[3]:= FilePrint["sperberList.txt"]


116.53694 6.07055 2213.13
116.53653 6.07055 2180.86
116.53612 6.07045 2132.29


116.54755 6.06546 3134.93
116.54642 6.06548 3027.8
116.54416 6.06562 2837.46


116.53122 6.06938 1858.43
116.531 6.06889 1820.12
116.53072 6.06808 1714.6


reicht schon

In[68]:= Clear[maL]
maL = ToExpression[
  Partition[
   Delete[#, Position[#, {">"}]] &[
    ReadList["sperberList.txt", Word, RecordLists -> True,
     RecordSeparators -> "\n"]], 3]]

Out[68]= {{{116.537, 6.07055, 2213.13}, {116.537, 6.07055,
   2180.86}, {116.536, 6.07045, 2132.29}}, {{116.548, 6.06546,
   3134.93}, {116.546, 6.06548, 3027.8}, {116.544, 6.06562,
   2837.46}}, {{116.531, 6.06938, 1858.43}, {116.531, 6.06889,
   1820.12}, {116.531, 6.06808, 1714.6}}}

In[69]:= Det[maL[[1]]]
Out[69]= -0.416543

hin; und falls das nicht feststeht

In[96]:= FilePrint["sperberList2.txt"]


116.53694 6.07055 2213.13
116.53653 6.07055 2180.86
116.53612 6.07045 2132.29


116.54755 6.06546 3134.93
116.54642 6.06548 3027.8


116.54416 6.06562 2837.46
116.53122 6.06938 1858.43
116.531 6.06889 1820.12
116.53072 6.06808 1714.6


dann tippen Sie

In[97]:= Clear[o, maL]
o = ReadList["sperberList2.txt", Word, RecordLists -> True,
   RecordSeparators -> "\n"];
maL = ToExpression[
  Take[o, #] & /@ (Plus[{1, -1}, #] & /@
     Partition[Flatten[Position[o, {">"}]], 2])]

Out[99]= {{{116.537, 6.07055, 2213.13}, {116.537, 6.07055,
   2180.86}, {116.536, 6.07045, 2132.29}}, {{116.548, 6.06546,
   3134.93}, {116.546, 6.06548, 3027.8}}, {{116.544, 6.06562,
   2837.46}, {116.531, 6.06938, 1858.43}, {116.531, 6.06889,
   1820.12}, {116.531, 6.06808, 1714.6}}}

In[100]:= Det[maL[[1]]]
Out[100]= -0.416543

Gruss
Udo.



Verweise:
Frühere   Chronologischer Index   Spätere
Vorherige   Thematischer Index   Nächste

DMUG DMUG-Archiv, http://www.mathematica.ch/archiv.html