<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" 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"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1649" name=GENERATOR>
<STYLE>@font-face {
font-family: Calibri;
}
@font-face {
font-family: Tahoma;
}
@font-face {
font-family: Lucida Sans Typewriter;
}
@page WordSection1 {size: 612.0pt 792.0pt; margin: 70.85pt 70.85pt 70.85pt 70.85pt; }
P.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US
}
LI.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US
}
DIV.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P.MsoAcetate {
FONT-SIZE: 8pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-fareast-language: EN-US; mso-style-priority: 99; mso-style-link: "Texte de bulles Car"
}
LI.MsoAcetate {
FONT-SIZE: 8pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-fareast-language: EN-US; mso-style-priority: 99; mso-style-link: "Texte de bulles Car"
}
DIV.MsoAcetate {
FONT-SIZE: 8pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-fareast-language: EN-US; mso-style-priority: 99; mso-style-link: "Texte de bulles Car"
}
SPAN.EmailStyle17 {
COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
SPAN.TextedebullesCar {
FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Texte de bulles"; mso-style-name: "Texte de bulles Car"
}
.MsoChpDefault {
FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US; mso-style-type: export-only
}
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 lang=FR vLink=purple link=blue>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff size=2>Hi
Loic,</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff size=2>Your
file contains two bytes before the beginning of the string (0x01, 0x00).
These characters cannot be correctly parsed as a string
type.</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff size=2>If you
add y=mfscanf(2,fd4,'%c') before the reading of the strings, then you find the
first string in the vector is "Mesure" as expected.</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff size=2>There
are more non-ASCII characters after the final string ("Alu"), which cause the
random extra strings at the end of your vector. You can either read a
limited number from the file (first parameter not == -1), or discard the last
elements of the string vector.</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff size=2>There
are lots of ways to make a single string from the vector. One way is
s=sprintf("%s ",x). The space after %s causes the elements to be separated
by a single space, if that's what you want.</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2>HTH,</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011><FONT face=Arial color=#0000ff
size=2>Mike.</FONT></SPAN></DIV>
<DIV><SPAN class=203015309-09022011></SPAN> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Loïc GIROD
[mailto:Loic.Girod@esstin.uhp-nancy.fr]<BR><B>Sent:</B> 09 February 2011
09:19<BR><B>To:</B> users@lists.scilab.org<BR><B>Subject:</B> [scilab-Users]
can not read all words in a ascii file<BR><BR></FONT></DIV>
<DIV class=WordSection1>
<P class=MsoNormal><SPAN lang=EN-US>Hello !<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>I try to read the characters in the
attached ASCII file.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>I would like to use the strings to make a
legend in a graph.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>I use the following code :
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: black; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">fd4</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">
<SPAN style="COLOR: #5c5c5c">=</SPAN> <SPAN
style="COLOR: #32b9b9">mopen</SPAN><SPAN style="COLOR: #4a55db">(</SPAN><SPAN
style="COLOR: rosybrown">"P_70"</SPAN><SPAN style="COLOR: black">,</SPAN><SPAN
style="COLOR: rosybrown">'r'</SPAN><SPAN
style="COLOR: #4a55db">)</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: black; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">x</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: #5c5c5c; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">=</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: #32b9b9; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">mfscanf</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: #4a55db; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">(</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: #5c5c5c; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">-</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: rosybrown; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">1</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: black; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">,fd4,</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: rosybrown; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">'%s'</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: #4a55db; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR">)</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Lucida Sans Typewriter'; mso-fareast-language: FR"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>but I get : <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>x =<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!des
!<o:p></o:p></SPAN></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>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!A
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!Air
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!Alu
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!A
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!A
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!A
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!A
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!A
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!D
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US>!D
!<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>As you can see, the first word is missing
and I don’t understand why.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Then I have not found how to convert x in
a single string.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Many thanks for the
help<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Best regards<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="mso-fareast-language: FR">Loïc<o:p></o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P></DIV></BLOCKQUOTE></BODY></HTML>