[Scilab-users] Dot Notation
samy
samad13 at hotmail.de
Tue Jan 8 10:03:14 CET 2013
hi serge,
the example work fine, but i have a question can you explain the individual steps.
i understand what the code do, but not completely.
thanks.
Date: Thu, 3 Jan 2013 09:50:32 -0800
From: ml-node+s994242n4025609h62 at n3.nabble.com
To: samad13 at hotmail.de
Subject: Re: Dot Notation
It would be easy if your file contained
something like
ASY.Pr.VER = 2.0
ASY.Pr.NAME = "Samy"
ASY.Pr.REKE = "XY"
ASY.Pr.LOG=[]
Because in such a case you may have only to exec it.
If you cannot produce such a file maybe you can proceed as follow
digits=string(0:9);
txt=stripblanks(mgetl('your file'));
txt(txt=='')=[]; //remove blank lines
n=size(txt,1); //the number of lines
I=[];
for k=1:n
t=tokens(txt(k),"=");
if size(t,'*')==2 then
t2=stripblanks(t(2));
if or(part(t2,1)==digits) then
I=[I;txt(k)];
else
I=[I;t(1)+"="""+t2+""""];
end
else
I=[I;txt(k)+"=[]"];
end
end
clear ASY
execstr(I)
//here ASY is a struct with one field named Pr and ASY.Pr
is a struct
ASY.Pr
Serge Steer
Le 03/01/2013 09:35, samy a écrit :
Hello everyone,
i want to read a text file with the following Output:
ASY.Pr.VER = 2.0
ASY.Pr.NAME = Samy
ASY.Pr.REKE = XY
ASY.Pr.LOG
and give it as a tlist in scilab for example
tlist(['Pr,'VER','NAME','REKE','LOG'],2.0,Samy, XY)
it's possible?
i have a large file
I thank you in advance for any help.
--
View this message in context: http://mailinglists.scilab.org/Dot-Notation-tp4025607.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
If you reply to this email, your message will be added to the discussion below:
http://mailinglists.scilab.org/Dot-Notation-tp4025607p4025609.html
To unsubscribe from Dot Notation, click here.
NAML
--
View this message in context: http://mailinglists.scilab.org/Dot-Notation-tp4025607p4025626.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130108/17afdcea/attachment.htm>
More information about the users
mailing list