Re: [Scilab-users] read format
Thank you Samuel, this works like a charm, even though the last step (evstr) takes a couple of minutes (8 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
Re: [Scilab-users] read format
with s given as follow s=['01/03/2015 00:01:00;5.49;1' '01/03/2015 00:01:01;5.9;1' '01/03/2015 00:01:11;4.9;1'] The following instructions returns the expexted results msscanf(-1,s,"%*s %*2s%*[:]%*2s%*[:]%*2s%*[;]%g[^;]%*[;]") But I do not succeed if the data are stored in a file u=mopen("","r") mfscanf(-1,u,"%*s %*2s%*[:]%*2s%*[:]%*2s%*[;]%g[^;]%*[;]") returns an error I think a C format specialist could be able to find my error Serge 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 ? > Thank you for your help. > JP Grivet > ___ > 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
Re: [Scilab-users] read format
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 (8 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
[Scilab-users] read format
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 ? Thank you for your help. JP Grivet ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
[Scilab-users] Get back the name of a function given as argument
Hi all, I am building some optimisation tools, and in this context, I was wondering if it was possible to get back the name of a function given as argument of another function. More specifically, consider the function 'fun' defined as deff('[f,g] = fun(x)','f = x^2;g = 2*x'); and an optimisation routine "minimize" which first argument is a function. Is there a way to get back the name of the function "fun" when calling "minimize(fun)" ? I would like to get back its name to wrap it inside another function which includes calls towards numerical derivatives, if needed. Best regards, Pierre Vuillemin ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] read format
Hello, 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
Re: [Scilab-users] read format
Hello, Perhaps this could help (there is probably a more direct way to do it) str1="00:01:00;5.49;1"; str2=strchr(str1,';'); //str2= ";5.49;1" str3=strtok(str2,';'); // str3 = "5.49" d = strtod(str3); Regards Guylaine -Message d'origine- De : users [mailto:users-boun...@lists.scilab.org] De la part de grivet Envoyé : lundi 12 octobre 2015 14:27 À : users@lists.scilab.org Objet : [Scilab-users] read format 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 ? Thank you for your help. JP Grivet ___ 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
Re: [Scilab-users] Get back the name of a function given as argument
Hi Pierre, Le 12/10/2015 16:46, Pierre Vuillemin a écrit : Hi all, I am building some optimisation tools, and in this context, I was wondering if it was possible to get back the name of a function given as argument of another function. More specifically, consider the function 'fun' defined as deff('[f,g] = fun(x)','f = x^2;g = 2*x'); and an optimisation routine "minimize" which first argument is a function. Is there a way to get back the name of the function "fun" when calling "minimize(fun)" ? I am afraid that, with 5.5.2, you have to use something like minimize("thefun") instead, with function argout = minimize(fun,...) execstr("fun="+fun); ... endfunction Samuel ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] read format
Le 12/10/2015 18:07, Clément David a écrit : M = csvRead('/tmp/sample.csv', ';', "double"); values = M(:,2); Indeed, or simply M = csvRead(theFileName, ';'); Without trying, i thought that meeting the date "01/03/2015 00:01:00;" would yield an error. But it is managed softly: it yields %nan instead. Scilab is great when it manages things softly :) This is why ieee(2) would be a soft default ;) Samuel ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users