<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 08/01/2013 10:03, samy a écrit :<br>
</div>
<blockquote cite="mid:BAY172-W299A406A48B751E2A1D89D7240@phx.gbl"
type="cite">
<div dir="ltr">
hi serge,<br>
the example work fine, but i have a question can you <span
id="result_box" class="short_text" lang="en"><span class="hps">explain</span>
<span class="hps">the individual steps</span></span>.<br>
i understand what the code do, but <span id="result_box"
class="short_text" lang="en"><span class="hps alt-edited">not
completely.<br>
thanks.<br>
</span></span><br>
<div>
<hr id="stopSpelling"><br>
<div class="ecxmoz-cite-prefix"><b> </b><b>digits=string(0:9);</b><b><br>
</b><b>txt=stripblanks(mgetl('your file'));</b><b> //read
the file and remove the leading and trailing blanks of
each line<br>
</b><b>txt(txt=='')=[]; //remove blank lines</b><b><br>
</b><b>n=size(txt,1); //the number of lines</b><b><br>
</b><b>I=[];</b><b><br>
</b><b>for k=1:n</b><b> //loop on each line <br>
</b><b> t=tokens(txt(k),"=");</b><b><br>
</b></div>
</div>
</div>
</blockquote>
<b>//if txt(k) contains something like </b>ASY.Pr.VER = 2.0 the
variable t will be equal to ["ASY.Pr.VER","2.0"]
<blockquote cite="mid:BAY172-W299A406A48B751E2A1D89D7240@phx.gbl"
type="cite">
<div dir="ltr">
<div>
<div class="ecxmoz-cite-prefix"><b> </b><b> if size(t,'*')==2
then</b><b> //there is an = sign in the line<br>
</b><b> t2=stripblanks(t(2));</b><b><br>
</b><b> if or(part(t2,1)==digits) then</b><b> //check if
the first character of t(2) is a digit<br>
</b></div>
</div>
</div>
</blockquote>
<b>//t2 begins with a digit, I assume t2 contains the representation
of a number , the associated line is not modified</b><br>
//because ASY.Pr.VER = 2.0 is a valid Scilab instruction<br>
<blockquote cite="mid:BAY172-W299A406A48B751E2A1D89D7240@phx.gbl"
type="cite">
<div dir="ltr">
<div>
<div class="ecxmoz-cite-prefix"><b> </b><b> I=[I;txt(k)];</b><b><br>
</b><b> else</b><b><br>
</b></div>
</div>
</div>
</blockquote>
<b>//t2 does not represent a numbe, expression like ASY.Pr.NAME=
Samy is not a valid Scilab instrution<br>
// (at least is Samy is not a defined variable)<br>
//such lines are transformed into </b><b><b>ASY.Pr.NAME= "Samy"</b><br>
</b>
<blockquote cite="mid:BAY172-W299A406A48B751E2A1D89D7240@phx.gbl"
type="cite">
<div dir="ltr">
<div>
<div class="ecxmoz-cite-prefix"><b> </b><b>
I=[I;t(1)+"="""+t2+""""];</b><b><br>
</b><b> end</b><b><br>
</b><b> else</b><b><br>
</b></div>
</div>
</div>
</blockquote>
<b>//if txt(k) does not contains an = sign, like </b><b><b>ASY.Pr.LOG
</b></b>this does not represent an assignment<br>
<b>//such lines are transformed into </b><b><b>ASY.Pr.LOG= [] (empty
matrix assigned to </b></b><b><b>ASY.Pr.LOG)</b></b>
<blockquote cite="mid:BAY172-W299A406A48B751E2A1D89D7240@phx.gbl"
type="cite">
<div dir="ltr">
<div>
<div class="ecxmoz-cite-prefix"><b> </b><b>
I=[I;txt(k)+"=[]"];</b><b><br>
</b><b> end</b><b><br>
</b><b>end</b><b><br>
</b><b>clear ASY</b><b><br>
</b></div>
</div>
</div>
</blockquote>
<b>//here I contains a sequence of valid Scilab instruction</b>s
that can be used to defined a struct<br>
<blockquote cite="mid:BAY172-W299A406A48B751E2A1D89D7240@phx.gbl"
type="cite">
<div dir="ltr">
<div>
<div class="ecxmoz-cite-prefix"><b> </b><b>execstr(I)</b><b>
//evaluate it <br>
</b><b>//here ASY is a struct with one field named Pr and
ASY.Pr is a struct</b><b><br>
</b><b>ASY.Pr</b><b><br>
</b><br>
<br>
Serge Steer<br>
<br>
Le 03/01/2013 09:35, samy a écrit :<br>
</div>
<blockquote style="border-left:2px solid #CCCCCC;padding:0
1em" cite="mid:1357202109323-4025607.post@n3.nabble.com">
<pre>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: <a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://mailinglists.scilab.org/Dot-Notation-tp4025607.html" rel="nofollow" target="_blank" link="external">http://mailinglists.scilab.org/Dot-Notation-tp4025607.html</a>
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
<a moz-do-not-send="true" href="http:///user/SendEmail.jtp?type=node&node=4025609&i=0" rel="nofollow" target="_blank" link="external">[hidden email]</a>
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" rel="nofollow" target="_blank" link="external">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
_______________________________________________
<br>
users mailing list
<br>
<a moz-do-not-send="true"
href="http:///user/SendEmail.jtp?type=node&node=4025609&i=1"
rel="nofollow" target="_blank" link="external">[hidden
email]</a>
<br>
<a moz-do-not-send="true"
href="http://lists.scilab.org/mailman/listinfo/users"
rel="nofollow" target="_blank" link="external">http://lists.scilab.org/mailman/listinfo/users</a><br>
<br>
<br>
<hr color="#cccccc" size="1">
<div style="color:#444;font:12px
tahoma,geneva,helvetica,arial,sans-serif">
<div style="font-weight:bold">If you reply to this email,
your message will be added to the discussion below:</div>
<a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Dot-Notation-tp4025607p4025609.html"
target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.org/Dot-Notation-tp4025607p4025609.html</a>
</div>
<div style="color:#666;font:11px
tahoma,geneva,helvetica,arial,sans-serif;line-height:1.5em">
To unsubscribe from Dot Notation, <a moz-do-not-send="true"
href="" target="_blank" rel="nofollow" link="external">click
here</a>.<br>
<a moz-do-not-send="true"
href="http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble:email.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble:email.naml-instant_emails%21nabble:email.naml-send_instant_email%21nabble:email.naml"
rel="nofollow" style="font:9px serif" target="_blank"
link="external">NAML</a> </div>
</div>
</div>
<br>
<hr align="left" width="300">
View this message in context: <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Dot-Notation-tp4025607p4025626.html">RE:
Dot Notation</a><br>
Sent from the <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">Scilab
users - Mailing Lists Archives mailing list archive</a> at
Nabble.com.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>