Scilab
Here it's the program
Posts  1 - 1  of  1
PetriaLucian
Pls Help me with this program. What i want to do is :
I have 1 txt file that looks like this :
/Curent : 99
/Power : 12345
/Name : ABCDEF
/Presure : 991234
/Name1 : dfmne
-------------------------
12345
678910
-111213
-141516
-171819

And i what to process the information. So if i enter from the keyboard Curent the program should show me it's value, that is "99"...and soo on. Thenumbers below the "-----------" should be in 2 vectors, one V1 for positive nr and V2 for negative. I made this for a startes but it doesn't work :( . Pls give me some hints soo and cand get on with it ! TKS A LOT

///
strMrVarNames =["Curent";"Power";"Torque";"Presure";"Angle"];
strMrValues = ["";"";"";"";""];
[txt]=mgetl('Var_fin.txt'); //get all lines
iNrOfLines=size (txt,1);
iNrOfLines1=size(strMrVarNames,1)
for i=1:iNrOfLines
txt(i);
//if we have '/'
if strindex( txt(i),'/') == 1 then

A=(tokens(txt(i),['/',':']))'; //Splits text in 2 coloms (value and name)
//A(1,$); //gives the value
//A($,1); //gives the variable

Name=A($,1)
Value=A(1,$);
for j=1:iNrOfLines1
val;
strMrVarNames(j);
if strcmp(Name,strMrVarNames(i,j))==1 then
disp("OK")
strMrValues=Value;
else strMrValues(i)="null";

end//if
end//for
end //if
end
strMrValues
strMrVarNames
Save
Cancel
Reply
 
x
OK