[Scilab-users] Reading numerical and string vectors from txt-file

Jan Åge Langeland j-lan at online.no
Wed Mar 22 23:55:37 CET 2017


On 22.03.2017 14:49, Jens Simon Strom wrote:
>
> Would you get to BAThour and BATminute the same way?
I would probably have done  it in a more complicated way:-), but I like  
this solution, it  seems quite robust for characters replacing missing 
numbers.

In case your number of header lines varies:

firstdata="2017"//something unique in the first dataline(or last header line)
maxheaderlength=10
Mh=mgetl(filename,maxheaderlength)
for  skiplines=1:size(Mh,1)
     if  strindex(Mh(skiplines),firstdata)~=[]  then  
         break
     end
end
skiplines=skiplines-1

Md=csvRead(filename,"",[],"string",[],[],[],skiplines)

Jan-Åge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170322/bb162fd6/attachment.htm>


More information about the users mailing list