[Scilab-users] using csvRead

Philipp Mühlmann p.muehlmann at gmail.com
Sun Oct 16 10:51:38 CEST 2016


Dear Samuel, Rafael,

thanks for taking my initial question further to a higher level.

I wouldn't have expected to create a bug out of it.

So, for me:

 I am fine with either creating a temporary file and using fscanfMat or
mfscanf().

In fact:

fscanfMat() is closer to my level of code understanding, since I get a
m-x-n matrix as a result

with mfscanf() I get an mlist.

Thanks a lot,
Philipp




2016-10-15 23:40 GMT+02:00 Samuel Gougeon <sgougeon at free.fr>:

> Le 15/10/2016 21:16, Samuel Gougeon a écrit :
>
> 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, 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.
>
> Report : http://bugzilla.scilab.org/14809
>
> Each char of a separator with length > 1 is considered a specific
> separator only if the whole separator pattern is met in the read row.
> Otherwise, no splitting is done. Hence,
> --> r = csvRead(TMPDIR+"test.csv","8.",[],"string") // splits the
> "12.08.2016" row, while
> --> r = csvRead(TMPDIR+"test.csv",".8",[],"string") // does not!
>
> Samuel Gougeon
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>


-- 
In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.

There we have the salad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161016/90685e0c/attachment.htm>


More information about the users mailing list