[Scilab-users] Dot Notation

samy samad13 at hotmail.de
Tue Jan 8 18:54:42 CET 2013


thanks serge ,
i have one more question,
i wrote a vb.net application, that give this output from a xml file 
BHCurve=tlist(['BHCurve';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point']);
BHCurve.Point=tlist(['Point';'B';'H'],0,0);
BHCurve.Point=tlist(['Point';'B';'H'],0.05,32);
BHCurve.Point=tlist(['Point';'B';'H'],0.1,55);
BHCurve.Point=tlist(['Point';'B';'H'],0.15,71);
BHCurve.Point=tlist(['Point';'B';'H'],0.2,82);
BHCurve.Point=tlist(['Point';'B';'H'],0.25,90);
BHCurve.Point=tlist(['Point';'B';'H'],0.3,96);
BHCurve.Point=tlist(['Point';'B';'H'],0.35,101.5);

Now i want to make a  a helplist function in scilab, that i can load in vb.net with the exec('Fullpath\function.sci');
for example 
function[]= zlist(argument)
zlist(str);
ztlist = tlist(['Typ';]) // empty tlist
ztlist(1)(2:size(argument(1,2))
finally the output will change 
BHCurve=ztlist(['BHCurve';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point';'Point']);
BHCurve.Point=ztlist(['Point';'B';'H'],0,0);
BHCurve.Point=ztlist(['Point';'B';'H'],0.05,32);
BHCurve.Point=ztlist(['Point';'B';'H'],0.1,55);.........
Can you understand what i want ??
thank you for you help


Date: Tue, 8 Jan 2013 08:20:22 -0800
From: ml-node+s994242n4025628h51 at n3.nabble.com
To: samad13 at hotmail.de
Subject: Re: Dot Notation



	
  
    
  
  
    Le 08/01/2013 10:03, samy a écrit :

    
    
      
        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.

          

        
          

           digits=string(0:9);

            txt=stripblanks(mgetl('your file')); //read
              the file and remove the leading and trailing blanks of
              each line

            txt(txt=='')=[]; //remove blank lines

            n=size(txt,1); //the number of lines

            I=[];

            for k=1:n //loop on each line 

             t=tokens(txt(k),"=");

            
        
      
    
    //if txt(k) contains something like ASY.Pr.VER = 2.0 the
    variable  t will be equal to ["ASY.Pr.VER","2.0"]
    
      
        
            if size(t,'*')==2
              then //there is an = sign in the line

               t2=stripblanks(t(2));

               if or(part(t2,1)==digits) then //check if
              the first character of t(2) is a digit

            
        
      
    
    //t2 begins with a digit, I assume t2 contains the representation
      of a number , the associated line is not modified

    //because ASY.Pr.VER = 2.0 is a valid Scilab instruction

    
      
        
                I=[I;txt(k)];

               else

            
        
      
    
    //t2 does not represent a numbe, expression like  ASY.Pr.NAME=
      Samy is not a valid Scilab instrution

      // (at least is Samy is not a defined variable)

      //such lines are transformed into ASY.Pr.NAME= "Samy"

    
    
      
        
               
              I=[I;t(1)+"="""+t2+""""];

               end

             else

            
        
      
    
    //if txt(k) does not contains an = sign, like ASY.Pr.LOG
      this does not represent an assignment

    //such lines are transformed into ASY.Pr.LOG= [] (empty
        matrix assigned to ASY.Pr.LOG)
    
      
        
             
              I=[I;txt(k)+"=[]"];

             end

            end

            clear ASY

            
        
      
    
    //here I contains a sequence of valid Scilab instructions
    that can be used to defined a struct

    
      
        
           execstr(I)
              //evaluate it 

            //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: RE:
        Dot Notation

      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-tp4025607p4025628.html
	
	
		
		To unsubscribe from Dot Notation, click here.

		NAML
	 		 	   		  



--
View this message in context: http://mailinglists.scilab.org/Dot-Notation-tp4025607p4025630.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/86bcc147/attachment.htm>


More information about the users mailing list