[Scilab-users] read format

grivet grivet at cnrs-orleans.fr
Tue Oct 13 12:09:03 CEST 2015


Your suggestion does not work for me. Here is what I get:
-->M = csvRead('dataN.txt', ';', "double");
  -->M(1:10,:)
  ans  =
      Nan    5.49    1.
     Nan    5.49    1.
     Nan    5.48    1.
     Nan    5.48    1.
     Nan    5.48    1.
which seems to check with the help for csvRead:

When the input argument "conversion" is equal to "double", the 
non-numeric fields within the .csv (e.g. strings) are converted into NaN.

Thank you for your time and help.
JP Grivet
> Hello,
>
> Well in fact the `evstr` call is not needed if you parse the csv and
> interpreting directly the values as "double" using :
>
> M = csvRead('/tmp/sample.csv', ';', "double");
> values = M(:,2);
>
> Regards,
>
> --
> Clément
>
> Le lundi 12 octobre 2015 à 18:00 +0200, grivet a écrit :
>> Thank you Samuel, this works like a charm, even though the last step
>> (evstr) takes a couple of minutes (80000 lines!).
>> For a completely different solution: read the file into emacs, define
>> a
>> rectangle of width 20 chars and height the whole file, delete this
>> rectangle, search for ".1" and erase every occurence of this string.
>> Thanks to everybody,
>> JP Grivet
>>
>>> Le 12/10/2015 14:26, grivet a écrit :
>>>> Hello,
>>>> I have a data file of about 80k lines. A typical line looks like
>>>> this:
>>>>          01/03/2015 00:01:00;5.49;1
>>>> (date time; value;parameter). I am only interested in the field
>>>> "value", which can be 3 or 4
>>>> characters wide (i.e. 5.49 or 5.4).
>>>> How can I extract the desired data from this file ?
>>> .
>>> Likely with
>>> M  = csvRead(TheFileName, ";", ".", "string");
>>> values = evstr(M(:,2));
>>>
>>> Samuel Gougeon
>>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list