help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to use textscan with gnu octave 3.6.2


From: brico
Subject: how to use textscan with gnu octave 3.6.2
Date: Thu, 10 Jan 2013 08:53:01 -0800 (PST)

hello :)

i am using gnu octave 3.6.2 since  10 days and  i ned to read all the rows
of a (.txt)file with textscan.
the file i want to read looks like 
"
4 = Interface Serial-No : 
5 = Calibrated by : 
6 = Radiation Quality : 
7 = Measuring Quantity :

[Kanal_Info]
;Kanal-Nr. =
Status(Aktiv/Inaktiv);A/D-Kanal(1-4);IF-KanalNr;X_0;Y_0;K-Faktor;"Bemerkung"

0 = Aktiv;1;0;-126;0;1.021;"" 
1 = Aktiv;1;1;-123;0;1.021;""
2 = Aktiv;1;2;-120;0;1.021;""
3 = Aktiv;1;3;-117;0;1.021;""
4 = Aktiv;1;4;-114;0;1.021;""
5 = Aktiv;1;5;-111;0;1.021;""
6 = Aktiv;1;6;-108;0;1.021;""
7 = Aktiv;1;7;-105;0;1.021;""
8 = Aktiv;1;8;-102;0;1.021;""
9 = Aktiv;1;9;-99;0;1.021;""
10 = Aktiv;1;10;-96;0;1.021;""   

and the code i am using is the following.
"
function error_code = Test2
fid2 = fopen('C:\Users\brico\Desktop\slow.txt');
txt = '';
while ~strcmp(txt, ';Kanal-Nr. =
Status(Aktiv/Inaktiv);A/D-Kanal(1-4);IF-KanalNr;X_0;Y_0;K-Faktor;"Bemerkung"')
txt = fgetl(fid2);
end
B = textscan(fid2, '%f = %s%f%f%f%f%f%s', 'delimiter', ';',
'MultipleDelimsAsOne', 1);
fclose(fid2);
x_array_in_mm = B{5};                                                           
y_array_in_mm = B{6};
property      = B{2};
AD_kanal      = B{3};
IF_kanal      = B{4};
Bemerkung     = B{8};
x_dist_in_mm = 10;
y_dist_in_mm = 10;
num_pos = length(x_array_in_mm);
result =  -ones(num_pos, 1);
x_array_in_mm
y_array_in_mm
property
..
Wenn i start this code on the comand window , it returns somethings else. I
did a sreenshot of the 
result and you can find it as  image_attachment. 
<http://octave.1599824.n4.nabble.com/file/n4648740/screenshot_octave.jpg>  
can any one help me? 

i have  ones used this code in Matlab and it has function.
thanks for your Help
Brico




--
View this message in context: 
http://octave.1599824.n4.nabble.com/how-to-use-textscan-with-gnu-octave-3-6-2-tp4648740.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]