[Scilab-users] Reading numerical and string vectors from txt-file
Jens Simon Strom
j.s.strom at hslmg.de
Thu Mar 23 00:25:17 CET 2017
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 ofcsvRead would interpret
several blanks as equivalent to one or if automation could be acchieved
elsewise.
Jens
--------------------------------------------------------------------------------------------------------------------------------------------------
Am 22.03.2017 23:55, schrieb Jan Åge Langeland:
> On 22.03.2017 14:49, Jens Simon Strom wrote:
>>
>> Would you get toBAThour andBATminute 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
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170323/0235dea2/attachment.htm>
More information about the users
mailing list