[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave beginner-reading info from text file
From: |
Zamuel |
Subject: |
Re: Octave beginner-reading info from text file |
Date: |
Wed, 15 Dec 2010 03:58:09 -0800 (PST) |
Thanks for the answer Jordi. I guess I took the hard way and managed to
separate the Perl data dumber format to a string (ex. class_b='1','2'). Now
I am facing the problem with string that cannot be handled as a array to sum
the numbers etc. I tried str2num, but it seems not to work.
fd = fopen ("jile.mat",'r');
[xt,cnt] = fscanf(fd,"%s");
start1=findstr(xt, "[["); #starting of the class measurements
end1=findstr(xt, "]]"); #ending of the class measurements
start1;
for I=1:4
range(I)=end1(I)-start1(I); #taking the range of each
measurement classes
endfor
class_b = substr(xt,start1(1)+2,range(1));
class_c = substr(xt,start1(2)+2,range(2));
class_d = substr(xt,start1(3)+2,range(3));
class_a = substr(xt,start1(4)+2,range(4));
test=str2num(class_b) # not working string to number conversion
--
View this message in context:
http://octave.1599824.n4.nabble.com/Octave-beginner-reading-info-from-text-file-tp3086763p3088859.html
Sent from the Octave - General mailing list archive at Nabble.com.