<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=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</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=DE link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Is there no other way with fewer code?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I thought about reading into a struct directly, because it looks<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Like, a matrix or array can only hold values of a single type.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Do the other functions not work properly and need to be fixed?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for your answer Louis.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
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"'>Von:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Osvaldo Sergio
Farhat de Carvalho [mailto:osvaldo@dcc.ufmg.br] <br>
<b>Gesendet:</b> Mittwoch, 4. November 2009 10:12<br>
<b>An:</b> users@lists.scilab.org<br>
<b>Betreff:</b> Re: [scilab-Users] Parsing ascii delimited data<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p style='margin-bottom:12.0pt'>Louis,<br>
<br>
I suggest to use functions mgetl and tokens, as in<br>
<br>
fd = mopen("data.csv","r");<br>
while ~meof(fd)<br>
line = mgetl(fd,1) // get one line as a string<br>
T = tokens(line,";"); //T will be a string vector<br>
// do something with T<br>
end<br>
mclose(fd)<br>
<br>
Osvaldo<br>
<br>
<br>
<br>
<img width=16 height=16 id="_x0000_i1025"
src="cid:image001.gif@01CA5D78.EBC18F30"
alt="Ocultação de detalhes inativa de"Louis" ---03/11/2009 20:23:10---Hi everyone."><span
style='color:#424282'>"Louis" ---03/11/2009 20:23:10---Hi everyone.</span><o:p></o:p></p>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%"
 style='width:100.0%'>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1026"
  src="cid:image002.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>De:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1027"
  src="cid:image003.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt'>"Louis" <louis@awake24.de></span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1028"
  src="cid:image002.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Para:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1029"
  src="cid:image003.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt'><users@lists.scilab.org></span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1030"
  src="cid:image002.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Data:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1031"
  src="cid:image003.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt'>03/11/2009 20:23</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1032"
  src="cid:image002.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Assunto:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1033"
  src="cid:image003.png@01CA5D78.EBC18F30"><br>
  <span style='font-size:10.0pt'>[scilab-Users] Parsing ascii delimited data</span><o:p></o:p></p>
  </td>
 </tr>
</table>

<div class=MsoNormal>

<hr size=2 width="100%" noshade style='color:#8091A5' align=left>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br>
<br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>Hi everyone.</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>I try to
parse a ascii delimited file.</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>If I try to
use fscanf I get this:</span><br>
<br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>-->a=fscanf(‘data.csv',
'%s;%s');</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'> !--error
999 </span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>msprintf:
Wrong number of input arguments: data doesn't fit with format.</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>at
line      51 of function sscanf called by :  </span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>[v1] =
sscanf(buf,frmt);</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>in 
execstr instruction    called by :  </span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>line   
41 of function fscanf called by :  </span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>a=fscanf('kapitalkurven_quelle.csv',
'%s;%s');</span><br>
<br>
<br>
<br>
<br>
<br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>If I try to
use mfscanf like this:</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>[n,a,b]=mfscanf(-1,
u, '%s;%s');</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>It does not
split the input line at ;.</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>So if I type
a I get this:</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!31.01.2003;115.918,60 
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!€        
             !!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!aaaaa;1.1,10 
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!€                     
!!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!bbbbbbb;1.2,50 
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!€                     
!!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!cccccc;1.22,00 
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!€                     
!!                      
!</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!dddddd;1.3,20 
!</span><br>
<br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>Can someone
help me so I will get something like this:</span><br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>!aaaaaaa 
! 1.1,10 !</span><br>
<br>
<span style='font-size:13.5pt;font-family:"Calibri","sans-serif"'>Thanks Louis.</span><br>
<br>
<o:p></o:p></p>

</div>

</body>

</html>