[Tutor] read text file in zip archive, process, plot
Kent Johnson
kent37 at tds.net
Sun Apr 15 19:08:27 CEST 2007
Washakie wrote:
> Thanks so much! Now another task, associated with this one... what I
> actually ultimately want is to just pull out several fields from the
> text file in the zip archive (there is actually only one file).. so, my
> goal is the to create a file that looks like:
>
> t[0], x[0], y[0]
> t[1], x[1], y[1]
> t[2], x[2], y[2]
> t[3], x[3], y[3]
> ...
> t[:], x[:], y[:]
>
> Note, these would actually be strings representing the values... and I'm
> not trying to do the header yet... :s
You could just write them out as you process them. The same loop that
reads the input lines can write the output lines.
>
> I've tried OUT = [t,x,y ]
> but when I write it out, it seems to go through all of t first, then x,
> then y...
> i'm having a really hard time switching my thinking away from matlab
> array processing which I think is part of my problem!!
Have you looked at NumPy? It has a native array type.
http://numpy.scipy.org/
http://www.scipy.org/NumPy_for_Matlab_Users
Kent
More information about the Tutor
mailing list