[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading matrix of unknown dimensions from file.
From: |
Mike Miller |
Subject: |
Re: reading matrix of unknown dimensions from file. |
Date: |
Thu, 4 Jul 2002 13:19:45 -0500 (CDT) |
On Thu, 4 Jul 2002, Arno Peters wrote:
> On Thu, Jul 04, 2002 at 10:37:17AM -0500, Mike Miller wrote:
> > By the way, is there a way to load a file that looks like this...
> >
> > 1 2 3 4
> > 1 2
> > 1 2 3 4 5
> > 1 2 3
> >
> > ...and have Octave automatically pad with zeros to produce a matrix in
> > Octave that looks like this?
> >
> > 1 2 3 4 0
> > 1 2 0 0 0
> > 1 2 3 4 5
> > 1 2 3 0 0
>
> Preprocess you file with the attached perl script.
Very nice. To get a number of columns in the output that does not exceed
the number of columns in the input, one may do this...
pad.pl `awk '{print NF}' infile | sort -rn | head -1` < infile > outfile
Thanks. I can use that. I still think a "load -pad" option in Octave
would be good.
Mike
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------