[Scilab-users] using csvRead

Rafael Guerra jrafaelbguerra at hotmail.com
Sat Oct 15 19:16:09 CEST 2016


Hi Samuel,

As the data is loaded by csvRead as strings in the example below (if loading as doubles then we get NaN's), it will require further processing to convert it to numeric (using evstr, tokens or other).
For very large data files, this seems to be rather slow compared to the mfscanf or fscanfMat solutions.

What do you think?

Regards,
Rafael

From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Samuel Gougeon
Sent: Saturday, October 15, 2016 5:55 PM
To: Users mailing list for Scilab <users at lists.scilab.org>
Subject: Re: [Scilab-users] using csvRead

Le 15/10/2016 15:45, Samuel Gougeon a écrit :
Hello

Le 14/10/2016 00:08, Philipp Mühlmann a écrit :
Dear Scilab users,
having a data file (*.cvs) containg following format:

HEADER-Line
dd.mm.yyyy, HH:MM:SS.MS<http://SS.MS>, value01, value02

dd = day
mm = month
yyyy = year
HH = hour
MM = minute
SS = second
Ms = milli second
ValueXY = numerical value

Is it possible to use cvsRead in such a way to define the separator beeing ',' and ':' at the same time?
Beside the solution provided by Serge, if you wish to stick to csvRead(), have you tried using its "substitute" option, with a [":" ","] value?
I didn't, but would be interested by results.
.
It works: the substitution is done before the splitting.
Example:
The file.csv content:
--------
Header line
12.08.2016, 13:54:18.45, 3.145, 548.4
--------

-->csvRead("file.csv",",",[],"string",[":", ","],[],[],1)
 ans  =
!12.08.2016   13  54  18.45   3.145   548.4  !

Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161015/efcdca52/attachment.htm>


More information about the users mailing list