<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>you may use csvTextScan function where you can pass the CSV
      separator as parameter. You can reach what you want calling ':'
      and ',' as separator parameter. As it was said, all lines must
      have the same number of columns and all columns must have the same
      number of lines.</p>
    <p>It may look like somethings like this :</p>
    <p>my_file = mgetl('your_file_path')</p>
    <p>first_eight_lines = csvTextScan(my_file(1:8), ':')</p>
    <p>header = csvTextScan(my_file(9), ',')     // ',' is set by
      default</p>
    <p>data = csvTextScan(my_file(10:$), ',')</p>
    <p>Cheers,<br>
      Alexis<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Le 19/06/2017 à 08:23,
      <a class="moz-txt-link-abbreviated" href="mailto:paul.carrico@free.fr">paul.carrico@free.fr</a> a écrit :<br>
    </div>
    <blockquote cite="mid:ca1cabc5ddbb7fb3d28d13e357111415@free.fr"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace">Hi</div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace">
        <p>I cannot say if the following is the best way to proceed, but
          when the number of columns differs, I always have a look to
          such functions in order to get the data:
          mopen/mgetl/grep/strindex and so on ... it need a bit of work.</p>
        <p>The previous method work when the file size is not huge
          because mgetl loads in memory all the file first - in case of
          huge files (I mean with millions of lines), I need to adopt
          another strategy (bash file using awk - grep - seb and so on
          tool) in order to have a text/matrix file in a right format
          ... nevertheless I do not get strings so the previous method
          may not work.</p>
      </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace">Just a feedback</div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace">Paul</div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace"> </div>
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace">Le 2017-06-18 23:10, Richard llom a écrit :
        <blockquote type="cite" style="padding: 0 0.4em; border-left:
          #1010ff 2px solid; margin: 0">Hello fellow scilab-users,<br>
          I'm writing a script to read and process files, which are
          constructed as<br>
          follows:<br>
          <file start><br>
          PCB: 007<br>
          ASM: 000<br>
          LOT: 00000<br>
          FW:  1477971088<br>
          CH1:  AMPS   10A<br>
          CH2:  VOLT   60V<br>
          SMPL: 0064 0125Hz<br>
          DESC: 12V CU LOG<br>
          UTC TIME SEC  ,CH1 AMPS DC  ,CH2 VOLT DC  <br>
          1497812372.910, 8.609146E-03, 1.210613E001<br>
          1497812373.895, 1.577809E-01, 1.207540E001<br>
          1497812374.578, 1.010268E000, 1.193087E001<br>
          ... [snip]<br>
          <file end><br>
          <br>
          To process this file further, I need:<br>
          1)<br>
          the first eight lines stored in pairs, e.g. <br>
          info(1,1) should yield "PCB" and info(1,2) should yield "007"
          (string is ok)<br>
          <br>
          2)<br>
          line #9 (header), should be available as header(1)="UTC TIME
          SEC", etc...<br>
          <br>
          3)<br>
          line 10+<br>
          these should be scanned in as a matrix.<br>
          <br>
          <br>
          I already tried csvread and msscanf (?), however with no luck
          so far...<br>
          <br>
          <br>
          So if someone could just point me to the apropiates function
          for each task.<br>
          I hopefully can take it then from there.<br>
          Thanks & cheers<br>
          richard<br>
          <br>
          <br>
          <br>
          --<br>
          View this message in context:<br>
          <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Advice-needed-on-file-parsing-tp4036587.html"
            target="_blank" rel="noreferrer">http://mailinglists.scilab.org/Advice-needed-on-file-parsing-tp4036587.html</a><br>
          Sent from the Scilab users - Mailing Lists Archives mailing
          list<br>
          archive at Nabble.com.<br>
          _______________________________________________<br>
          users mailing list<br>
          <a moz-do-not-send="true" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
          <a moz-do-not-send="true"
            href="http://lists.scilab.org/mailman/listinfo/users"
            target="_blank" rel="noreferrer">http://lists.scilab.org/mailman/listinfo/users</a></blockquote>
      </div>
      <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>