<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <span style="color:rgb(50,185,185);">mgetl</span><span
      style="color:rgb(74,85,219);">(</span><span
      style="color:rgb(0,0,0);">filename</span><span
      style="color:rgb(74,85,219);">)</span><span
      style="color:rgb(0,0,0);">  is a good alternative. I have used it
      in a function because retrieving numbers comes up frequently for
      me.<br>
       </span><br>
    <pre style="font-family:Monospaced;font-style:normal;font-size:13.0;"><big><big><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">cv</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">!cv</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">fp</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(131,67,16);font-weight:bold;">colspan</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(131,67,16);font-weight:bold;">varargin</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(100,174,100);font-style:italic;">//Extracts a numeric Colum Vector from ASCII file</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//Data separator in file:  spaces only, number may differ from line to line to cope with ragged colums</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//fp: full path of ASCII file, type string</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//colspan: Increasing row vector of colum indices, position range of the numbers, type constant</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//         The data colum may be ragged but no other characters may protrude into the colum span.</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//varargin: optional string vector, line numbers to read</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//cv: colum vector of read numbers, type constant</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//CAVEAT: If the file uses separating tabs they should be replaced by blanks. colspan should be enclosed </span>
  <span style="color:rgb(100,174,100);font-style:italic;">//        in at least one leading and one trailing blank in all lines (check in editor). </span>
  <span style="color:rgb(100,174,100);font-style:italic;">//Examples:</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//cv=!cv(</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">file.txt</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">,[12:15]) //reads colums 12 to 15 of all lines</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//cv=!cv(</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">file.txt</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">,[1:6],</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">[10:$-3]</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">) //reads colums 1 to 6 of 10th to third last line, good for masking headers and footers</span>
  <span style="color:rgb(100,174,100);font-style:italic;">//cv=!cv(</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">file.txt</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">,[1:6],</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">[1 11 101]</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">) //reads distant lines  </span>
  <span style="color:rgb(0,0,0);">fdescr</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">mopen</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">fp</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">r</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span><span style="color:rgb(100,174,100);font-style:italic;">//file descriptor</span>
  <span style="color:rgb(0,0,0);">txtlines</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mgetl</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">fdescr</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span><span style="color:rgb(100,174,100);font-style:italic;">//string colum vector with all lines</span>
  <span style="color:rgb(50,185,185);">mclose</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">fdescr</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
  <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">lhs</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">rhs</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">argn</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(74,85,219);">)</span>
  <span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(0,0,0);">rhs</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">3</span> <span style="color:rgb(160,32,240);">then</span>
      <span style="color:rgb(50,185,185);">execstr</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">txtlines=txtlines(</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(131,67,16);font-weight:bold;">varargin</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">)</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(100,174,100);font-style:italic;">//reduction to the requested lines</span>
  <span style="color:rgb(160,32,240);">end</span>
  <span style="color:rgb(131,67,16);font-weight:bold;">cv</span> <span style="color:rgb(92,92,92);">=</span>  <span style="color:rgb(50,185,185);">strtod</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">part</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">txtlines</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(131,67,16);font-weight:bold;">colspan</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(100,174,100);font-style:italic;">//string to double</span>
</big></big><span style="color:rgb(176,24,19);"><big><big>endfunction</big></big>

</span></pre>
    <big><span style="color:rgb(176,24,19);"><font color="#330033">Jens</font></span><br>
      <span style="color:rgb(176,24,19);"><font color="#330033">---------------------------------------------------------------------------------------------------</font></span></big><br>
    <span style="color:rgb(176,24,19);"></span><br>
    <div class="moz-cite-prefix">Am 23.03.2017 09:51, schrieb Jan Åge
      Langeland:<br>
    </div>
    <blockquote
      cite="mid:d182ce9e-69af-5026-4255-1cae6adba369@online.no"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <p><br>
      </p>
      <br>
      <div class="moz-cite-prefix">On 23.03.2017 00:25, Jens Simon Strom
        wrote:<br>
      </div>
      <blockquote cite="mid:58D307DD.20601@hslmg.de" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        The test data I posted had been preprocessed manually by
        equalizing the spaces between the colums to a single one. The
        original output of the MICA astro software aligns the colums
        tidily so that the number of spaces varies along a line and from
        line to line if the values vary between 1 and 3 digits. One can
        fix that with regex. It would be workflow supporting if the
        separator input of<font face="Courier New, Courier, monospace">
          csvRead</font> would interpret several blanks as equivalent to
        one or if automation could be acchieved elsewise.<br>
        <pre style="font-family:Monospaced;font-style:normal;font-size:13.0;"><big><big><font color="#330033">Jens</font></big></big>
--------------------------------------------------------------------------------------------------------------------------------------------------
</pre>
        <br>
      </blockquote>
      If you have fixed column widths, maybe something like this is
      better:<br>
      <span lang="NO-BOK"></span><span style="color:rgb(0,0,0);"><br>
        Ma</span><span style="color:rgb(92,92,92);">=</span><span
        style="color:rgb(50,185,185);">mgetl</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">filename</span><span
        style="color:rgb(74,85,219);">)</span><span
        style="color:rgb(0,0,0);"><br>
        skiplines</span><span style="color:rgb(92,92,92);">=</span><span
        style="color:rgb(188,143,143);">7</span><span
        style="color:rgb(50,185,185);"><br>
        clear</span> <span style="color:rgb(188,143,143);">Md</span><span
        style="color:rgb(160,32,240);"><br>
        for</span> <span style="color:rgb(0,0,0);">i</span><span
        style="color:rgb(92,92,92);">=</span><span
        style="color:rgb(0,0,0);">skiplines</span><span
        style="color:rgb(92,92,92);">+</span><span
        style="color:rgb(188,143,143);">1</span><span
        style="color:rgb(255,170,0);">:</span><span
        style="color:rgb(50,185,185);">size</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">Ma</span><span
        style="color:rgb(0,0,0);">,</span><span
        style="color:rgb(188,143,143);">1</span><span
        style="color:rgb(74,85,219);">)</span> <span
        style="color:rgb(188,143,143);"></span><br>
         <span style="color:rgb(0,0,0);">Md</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">i</span><span
        style="color:rgb(92,92,92);">-</span><span
        style="color:rgb(0,0,0);">skiplines</span><span
        style="color:rgb(0,0,0);">,</span><span
        style="color:rgb(188,143,143);">1</span><span
        style="color:rgb(255,170,0);">:</span><span
        style="color:rgb(188,143,143);">22</span><span
        style="color:rgb(74,85,219);">)</span><span
        style="color:rgb(92,92,92);">=</span><span
        style="color:rgb(50,185,185);">strsplit</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">Ma</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">i</span><span
        style="color:rgb(74,85,219);">)</span><span
        style="color:rgb(0,0,0);">,</span><span
        style="color:rgb(74,85,219);">[</span><span
        style="color:rgb(188,143,143);">4</span> <span
        style="color:rgb(188,143,143);">8</span> <span
        style="color:rgb(188,143,143);">12</span> <span
        style="color:rgb(188,143,143);">17</span> <span
        style="color:rgb(188,143,143);">20</span> <span
        style="color:rgb(188,143,143);">21</span> <span
        style="color:rgb(188,143,143);">24</span> <span
        style="color:rgb(188,143,143);">26</span> <span
        style="color:rgb(188,143,143);">27</span> <span
        style="color:rgb(188,143,143);">29</span> <span
        style="color:rgb(188,143,143);">33</span> <span
        style="color:rgb(188,143,143);">35</span> <span
        style="color:rgb(188,143,143);">36</span> <span
        style="color:rgb(188,143,143);">38</span> <span
        style="color:rgb(188,143,143);">42</span> <span
        style="color:rgb(188,143,143);">45</span> <span
        style="color:rgb(188,143,143);">46</span> <span
        style="color:rgb(188,143,143);">48</span> <span
        style="color:rgb(188,143,143);">53</span> <span
        style="color:rgb(188,143,143);">55</span> <span
        style="color:rgb(188,143,143);">56</span><span
        style="color:rgb(74,85,219);">]</span><span
        style="color:rgb(74,85,219);">)</span><span
        style="color:rgb(92,92,92);">'</span><span
        style="color:rgb(160,32,240);"><br>
        end</span><span style="color:rgb(160,32,240);"></span><br>
      <br>
      Jan-Åge<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>