[Scilab-users] using csvRead

Philipp Mühlmann p.muehlmann at gmail.com
Fri Oct 14 11:50:06 CEST 2016


Dear Denis,

yes thats the way I do it right now.

use mopen --> open file for reading
use mgetl --> read data, result = array of strings
use strsplit --> split  string Array as desired

use evestring() --> convert string to double

Point of disadvantage

So fa I know strsplit() can handle only one string.
Hence I use a for-loop to split each line of the Initial string array into
a group of strings and convert each part into a double.

OK for few data...may take long for many data

Idea:

Read data from file and try to spare conversation string-to-double.

fscanfMat() won't do it, because the data does not contain only numerical
values and "."-sign as decimal.

So I tried csvRead.

using the help I find:      separator :  a 1-by-1 matrix of strings, the
field separator used.


Note:   STRINGS   = plural.

So I wonder if it is possible to have more than one separator here.




BR
Philipp

mclose( :-) )


2016-10-14 0:51 GMT+02:00 CRETE Denis <denis.crete at thalesgroup.com>:

> Hello Philipp,
>
>
>
> In this case I first attempt to read first (e.g. with “mopen” and “getl”)
> and then split the strings with “tokens” where the feature of multiple
> separators exists.
>
> Of course you can also use “cvsRead” with one separator and then use
> “tokens” to finish with the other separators.
>
> HTH
>
> Denis
>
>
>
> [@@ THALES GROUP INTERNAL @@]
>
>
>
> Unité Mixte de Physique CNRS / THALES
>
> 1 Avenue Augustin Fresnel
>
> 91767 Palaiseau CEDEx - France
>
> Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
>
> e-mail :
>
>  denis.crete at thalesgroup.com <mailto:%20denis.crete at thalesgroup.com
> <%20denis.crete at thalesgroup.com>>
>
> http://www.trt.thalesgroup.com/ump-cnrs-thales
>
> http://www.research.thalesgroup.com
>
>
>
> *De :* users [mailto:users-bounces at lists.scilab.org] *De la part de*
> Philipp Mühlmann
> *Envoyé :* vendredi 14 octobre 2016 00:08
> *À :* International users mailing list for Scilab.
> *Objet :* [Scilab-users] using csvRead
>
>
>
> 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?
>
> Background:
>
> desired Matrix after reading the file is
>
> M = [dd mm yyyy HH MM SS MS value1 value2]
>
>
>
> Thank you,
>
> Philipp
>
>
>
> --
>
> In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.
>
>
>
> There we have the salad.
>
> _______________________________________________
> 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/20161014/8b9e05ba/attachment.htm>


More information about the users mailing list