I’m very used to MATLAB, where I could just write:
m = load('test.dat');
m would be a a matrix of values in test.dat, as long as each line was formatted the same way. But in Octave it doesn’t work:
I tried fscanf, but the documentation is very scanty:
fh = fopen('test.dat', 'r');
[m, count] = fscanf(fh, '%10s%10s%f');
m ends up as a single dimensional array of chars.
Suppose I have the following data:
03/12/2011 00:00 0.2151
...
How can I read this into a matrix in Octave?
Have you consider to use
dlmread?However, if you are able to delimit the file like
03/12/2011,00:00,0.2151thencsvreadwill be able to handle it for you.