But you said you were just interested in the last two numeric values : with 
double conversion into csvRead call it's the fastest way to get the relevant 
information and process it further. Would you need to get the timestamps data, 
you may call csvRead with "string" conversion and process the first column of 
the matrix of string to retrieve numeric value fields. 

Cheers,

David Chèze              

-----Message d'origine-----
De : users [mailto:users-boun...@lists.scilab.org] De la part de grivet
Envoyé : mardi 13 octobre 2015 12:09
À : Clément David <clement.da...@scilab-enterprises.com>; Users mailing list 
for Scilab <users@lists.scilab.org>
Objet : Re: [Scilab-users] read format

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@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to