<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Lucida Sans Typewriter";
        panose-1:2 11 5 9 3 5 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texte de bulles Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.TextedebullesCar
        {mso-style-name:"Texte de bulles Car";
        mso-style-priority:99;
        mso-style-link:"Texte de bulles";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hello Mathieu, <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thanks for the help. </span><span lang=EN-US style='color:#1F497D'>Indeed, it does not work with my file but it works with your example.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Bye<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:FR'>Loïc<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:FR'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:FR'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:FR'>--<o:p></o:p></span></p></div><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR'> Mathieu Dubois [mailto:mathieu.dubois@limsi.fr] <br><b>Envoyé :</b> mercredi 9 février 2011 11:18<br><b>À :</b> users@lists.scilab.org<br><b>Objet :</b> Re: [scilab-Users] can not read all words in a ascii file<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hello,<br><br>The fact that you get a string matrix is related to the way mscanf works (it's a bit complicated, see the examples in help page). Basically, like scanf in C, %s reads a string delimited by whitespace (therefore you get a string per word).<br><br>To read lines in a file see mgetl.<br><br>I didn't succeed to read the file you send (it looks like it contains strange bytes and maybe that's why mscanf don't works) but it works with the attached file.<br><tt><span style='font-size:10.0pt'>-->fd4 = mopen("P_70",'r');</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt> </tt><br><tt>-->mgetl(fd4)</tt><br><tt> ans  =</tt><br><tt> </tt><br><tt> A legendary legend </tt><br></span><br>Mathieu<br><br>On 02/09/2011 10:19 AM, Loïc GIROD wrote: <o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Hello !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>I try to read the characters in the attached ASCII file.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>I would like to use the strings to make a legend in a graph.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>I use the following code : </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter"'>fd4 </span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:#5C5C5C'>=</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter"'> </span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:#32B9B9'>mopen</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:#4A55DB'>(</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:rosybrown'>"P_70"</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter"'>,</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:rosybrown'>'r'</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:#4A55DB'>)</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter"'>x</span><span lang=EN-US style='font-size:10.5pt;font-family:"Lucida Sans Typewriter";color:#5C5C5C'>=</span><span lang=EN-US style='font-size:10.5pt'>mfscanf(-1,fd4,'%s')</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>but I get : </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>x  =</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!des              !</span><o:p></o:p></p><p class=MsoNormal>!                 !<o:p></o:p></p><p class=MsoNormal>!points           !<o:p></o:p></p><p class=MsoNormal>!                 !<o:p></o:p></p><p class=MsoNormal>!de               !<o:p></o:p></p><p class=MsoNormal>!                 !<o:p></o:p></p><p class=MsoNormal>!transformations  !<o:p></o:p></p><p class=MsoNormal>!                 !<o:p></o:p></p><p class=MsoNormal>!simple           !<o:p></o:p></p><p class=MsoNormal>!                 !<o:p></o:p></p><p class=MsoNormal>!DSC              !<o:p></o:p></p><p class=MsoNormal>!                 !<o:p></o:p></p><p class=MsoNormal>!Essai            !<o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!A                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!Air              !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!Alu              !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!A                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!A                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!A                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!A                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!A                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!D                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!                 !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>!D                !</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>As you can see, the first word is missing and I don’t understand why.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Then I have not found how to convert x in a single string.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Many thanks for the help</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Best regards</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Loïc</span><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:FR'><o:p> </o:p></span></p></div></body></html>