[Scilab-users] Reading numerical and string vectors from txt-file
Jan Åge Langeland
j-lan at online.no
Thu Mar 23 09:51:27 CET 2017
On 23.03.2017 00:25, Jens Simon Strom wrote:
> 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
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
If you have fixed column widths, maybe something like this is better:
Ma=mgetl(filename)
skiplines=7
clear Md
for i=skiplines+1:size(Ma,1)
Md(i-skiplines,1:22)=strsplit(Ma(i),[4 8 12 17 20 21 24 26 27 29 33 35
36 38 42 45 46 48 53 55 56])'
end
Jan-Åge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170323/c93130e2/attachment.htm>
More information about the users
mailing list