[Scilab-users] using csvRead

Samuel Gougeon sgougeon at free.fr
Sat Oct 15 21:16:05 CEST 2016


Hello Philipp,

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?
.
Yes and no: Yes because each character of the "separator" option is 
(sometimes) considered as a
separator. And no, because it sometimes fails.
I was designing an example to add to the csvRead() page, when a found 
this bug:

--> mputl("12.08.2016, 13:54:18.45, 3.145, 548.4", TMPDIR+"/test.csv")

--> r = "''"+csvRead("test.csv","8.",[],"string")+"''"
  r  =
!'12'  '0'  '2016, 13:54:1'  '45, 3'  '145, 54'  '4'  !
--> // it works: both "8" and "." are *separately* considered as separators

--> // now trying with "," and ":":
--> r = "''"+csvRead("test.csv",",:", [], "string")+"''"
--> r = "''"+csvRead("test.csv",",:", [], "string")+"''"
  r  =
  '12.08.2016, 13:54:18.45, 3.145, 548.4'
--> // The row is kept as is: no splitting!
--> // We could expect: ['12.08.2016' ' 13' '54' '18.45' ' 3.145' ' 548.4']
--> //  (with leading spaces, since they are not set as separators)
-->

There are already 10 pending reported bugs about csvRead(). One more.

Samuel

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


More information about the users mailing list