help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading text file


From: Jordi Gutiérrez Hermoso
Subject: Re: Reading text file
Date: Wed, 27 Jan 2010 17:52:23 -0600

2010/1/27 Roi Granot <address@hidden>:
> I'm trying to read an ascii file that has the following format:
>
> blabla 12.2 14.23 312.32 ...
> blabla 32.1 32.32 32.2 ...
> ...
>
> The file has a string in the first column and numbers in the rest of the
> columns. The trick here is that every time the code runs, it may read a file
> that contains different number of columns (e.g., one time a total of 10
> columns, other time a total of 4 columns, but always in the format that is
> described above). Is there a way to read this kind of file, without an a
> priory knowledge of the number of columns?

This very well depends into what do you want to read it.

Is the blabla string important? If not, I would massage your data
first with a text munger (e.g. Perl) to remove that string and then
use Octave's ordinary "load" function to read your matrix.

If not, you may need to do your own parsing with C-style IO functions in Octave.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]