MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Reading from a file.


Hi Namrata, 

< snippage> 

> 
> So the real numbers matrix is of size [7][6]

In Mathematica, the notation is {7,6} ....

> 
> I have tried quite a few things but nothing seems to be working.

Really?  What did you try?  You may have been close to a solution, but who
can tell since there is no code ....

Anyway, it's not particularly efficient but

inpu = OpenRead["test.txt"]
data = ReadList[inpu, Record, RecordSeparators->{"%Object Name : left asis",
"%Object Name : right asis"}];
Close[inpu];
data = Flatten[data]
proc = ReadList[StringToStream[#], Table[Number, {6}]]& /@ data
proc = Partition[Flatten[proc], 6]
MatrixForm[proc]

Works for me.  

Another version might use Find to skip over the problematic records and yet
another might export the first data record to yet another file & Import it.

Regards,

Dave.


  • Prev by Date: Re: Creating forms for user input in Mathematica
  • Next by Date: Re: GUIkit problem
  • Previous by thread: Re: Reading from a file.
  • Next by thread: Re: Reading from a file.