On Sat, Feb 25, 2012 at 6:45 PM, Terry Duell
<address@hidden> wrote:
Hullo All,
I am running Octave 3.6.1, and have encountered a difficulty with fileread.
I am advised that the code segment (runtestdata.m) below which reads the test data from a file (testdata) OK in Matlab and displays the data as expected, but does not work for me in Octave.
In Matlab the code reads the data in the first 3 records into 'header', then reads the values '0.30, 0.21...' etc into 'data', then does a str2num conversion on 'data' to put the values into 'y'.
Here, in Octave, the string 'data' starts out as follows...
0
0
.
2
1
I guess some tweaking of the character counts (104, 105) will affect that, but I wouldn't have expected the behaviour of Octave and Matlab to be different.
In addition, if I check the size of 'y' after the str2num conversion, the response is ...
ans =
0 0
Is the behaviour I'm seeing the result of a bug?
runtestdata.m
-----------------
dd=fileread("testdata");
header=dd(1:104);
data="">
y=str2num(data);
figure
plot(y)
grid on
drawnow
testdata
----------
DLEFT
Survey Date : : 30-10-90 12:22:18, 1, Test 1, 2, Test 2 (DETRENDED)
18234 11.83
0.30
0.21
0.40
0.40
0.31
0.20
0.29
0.22
0.26
0.26
0.35
0.42
0.44
0.65
0.59
0.59
0.61
0.62
0.62
0.68
0.68
0.70
0.66
0.65
0.75
--
Regards,
Terry Duell
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave