[Scilab-users] Read file (.txt)

Jan Åge Langeland j-lan at online.no
Thu Sep 10 11:30:54 CEST 2020


The main problem I ran into with csvRead was reading files with a 
variable number of separators in each row. Then my suggested solution 
pads with 0. It could be changed to pad with NaN also.

Using strsplit in each row allows for several separators in the same 
conversion.  It may still be useful to use evstr row by row instead, if 
the number of spaces between numbers vary.

J


On 2020-09-10 10:46 AM, P M wrote:
> I think csvRead is just fine.
>
> [data  header]  =  csvRead(fname,  '',  '.',  'string',  [],  [],  [],  0);
> As you may notice the data Matrix contains a lot of empty columns.
> This is due to the many white spaces in the text file
> anyways, after reading the dta in you may use evstr() to convert into 
> doubles.
> BR
> Philipp
>
> Am Do., 10. Sept. 2020 um 04:03 Uhr schrieb 
> <antoine.elias at scilab-enterprises.com 
> <mailto:antoine.elias at scilab-enterprises.com>>:
>
>     Hello Daniel,
>
>     Do you have try with "evstr" function ?
>
>     data = evstr(mgetl("output.txt"));
>
>     Regards,
>     Antoine
>
>     _______________________________________________
>     users mailing list
>     users at lists.scilab.org <mailto:users at lists.scilab.org>
>     http://lists.scilab.org/mailman/listinfo/users
>
>
> _______________________________________________
> 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/20200910/eb8d67b6/attachment.htm>


More information about the users mailing list