<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<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 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 href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br /> <a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank" rel="noreferrer">http://lists.scilab.org/mailman/listinfo/users</a></blockquote>
</div>
</body></html>