Load ascii file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Load ascii file

Albatross-2
Hi,
I would like to load an ascii data file (created from a spreadsheet) in octave
but I've some problems.
The file starts in this way:

# name: data
# type: matrix
# rows: 720
# columns: 22
 0.000 5.431 2.949 2.911 4.731 50.133  9.498 -0.442 -0.368  -0.239 .....

every line has 22 elements. I'm sure about this since I've used awk to check.
and there are 720 data lines, but when I use "load -ascii filename" I get the
error:

error: load: failed to load matrix constant
error: load: reading file prova4.prn
error: evaluating index expression near line 1, column 1

What's wrong?

Many thanks for any suggestion or help.


Reply | Threaded
Open this post in threaded view
|

Re: Load ascii file

Heber Farnsworth-2
When I have had problems like this the answer is always that one of the entries
is not a number.  For instance if your spreadsheet puts some character for a
missing value that is not a number then awk will tell you there are 22 elements
per line but Octave won't be able to load it.

That's as good a guess as I can make.

Heber Farnsworth

> # name: data
> # type: matrix
> # rows: 720
> # columns: 22
>  0.000 5.431 2.949 2.911 4.731 50.133  9.498 -0.442 -0.368  -0.239 .....
>
> every line has 22 elements. I'm sure about this since I've used awk to check.
> and there are 720 data lines, but when I use "load -ascii filename" I get the
> error:
>
> error: load: failed to load matrix constant
> error: load: reading file prova4.prn
> error: evaluating index expression near line 1, column 1
>
> What's wrong?
>
> Many thanks for any suggestion or help.
>
>