[Scilab-users] Dot Notation

Serge Steer Serge.Steer at inria.fr
Thu Jan 3 18:50:17 CET 2013


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
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130103/926b17ce/attachment.htm>


More information about the users mailing list