Re: [Scilab-users] Put .txt data in matrix

2013-12-12 Thread GOBILLOT Gilles 116128
I use to read text files with Scilab. This piece of code is close to the one I 
use.

To save time, one can give a dimension to ‘m’ :
Instead of m=[]
Prefer m=zeros(1,4); // by-exemple


Gilles
Tel : +33 (0)4 42 25 20 33 -  Mob : +33 (0) 6 87 99 19 57 - Fax : +33 (0)4 42 
25 49 17
gilles.gobil...@cea.frmailto:gilles.gobil...@cea.fr


De : users [mailto:users-boun...@lists.scilab.org] De la part de simon_37
Envoyé : jeudi 12 décembre 2013 10:46
À : users@lists.scilab.org
Objet : Re: [Scilab-users] Put .txt data in matrix

Hi Osvaldo,
Thanks for your reply.
I think your piece of code is the most efficient that I search.
But Scilab don't recognize the not in the while loop parameters...
I am trap.
Regards
Simon


2013/12/11 Osvaldo Carvalho [via Scilab / Xcos - Mailing Lists Archives] 
[hidden email]/user/SendEmail.jtp?type=nodenode=4028020i=0
If you want to ignore exactly the first 15 lines, you can use:

f = mopen(your file,r);
garbage = mgetl(f,15);
m = [];
while not meof(f)
line = mgetl(f,1); // read one line
lineNr = eval(tokens(line))'; // dont forget the '
m = [m;lineNr]; // add one line to m
end

-users [hidden 
email]http://user/SendEmail.jtp?type=nodenode=4028015i=0 escreveu: -
Para: [hidden email]http://user/SendEmail.jtp?type=nodenode=4028015i=1
De: simon_37
Enviado por: users
Data: 11/12/2013 01:50 PM
Assunto: Re: [Scilab-users] Put .txt data in matrix
It doesn't work to, I already try it.
It return me error 999


--
View this message in context: 
http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028013.html

Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
[hidden email]http://user/SendEmail.jtp?type=nodenode=4028015i=2
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
[hidden email]http://user/SendEmail.jtp?type=nodenode=4028015i=3
http://lists.scilab.org/mailman/listinfo/users


If you reply to this email, your message will be added to the discussion below:
http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028015.html
To unsubscribe from Put .txt data in matrix, click here.
NAMLhttp://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



View this message in context: Re: Put .txt data in 
matrixhttp://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028020.html
Sent from the Scilab users - Mailing Lists Archives mailing list 
archivehttp://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
 at Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Put .txt data in matrix

2013-12-12 Thread simon_37
Thanks you to everyone for their help.
It's finally done.

I drop my code :

[FileName,PathName] = uigetfile('','','sélectionnez le(s) fichier(s) à
traiter',%t);
f = fullfile(PathName, FileName)
f1 = mopen(f,r);
garbage = mgetl(f1,15);
m = [];
while ~meof(f1) 
line = mgetl(f1,1) // read one line
if line == [] then
break
end
lineNr = eval(tokens(line))' // dont forget the '
m = [m;lineNr] // add one line to m   
end

x1=m(:,1)
y1=m(:,2)
x2=m(:,3)
y2=m(:,4)

plot(x1,y1)

Regards 
Simon



--
View this message in context: 
http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028022.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Put .txt data in matrix

2013-12-12 Thread Osvaldo Sergio Farhat de Carvalho

Ooops:while ~meof 
-"users" users-boun...@lists.scilab.org escreveu: -

Para: users@lists.scilab.orgDe: simon_37 <simmar...@gmail.com>Enviado por: "users" <users-boun...@lists.scilab.org>
Data: 12/12/2013 07:46 AMAssunto: Re: [Scilab-users] Put .txt data in matrix
Hi Osvaldo,
Thanks for your reply.I think your "piece" of code is the most efficient that I search.
But Scilab don't recognize the "not" in the while loop parameters...
I am trap.RegardsSimon

2013/12/11 Osvaldo Carvalho [via Scilab / Xcos - Mailing Lists Archives] 

[hidden email]

If you want to ignore exactly the first 15 lines, you can use:f = mopen("your file","r");
garbage = mgetl(f,15);m = [];while not meof(f)ÂÂÂ line = mgetl(f,1); // read one line
ÂÂÂ lineNr = eval(tokens(line))'; // dont forget the ' 
ÂÂÂ m = [m;lineNr]; // add one line to mend
-"users" 
[hidden email] escreveu: -

Para: 
[hidden email]De: simon_37 Enviado por: "users" Data: 11/12/2013 01:50 PM
Assunto: Re: [Scilab-users] Put .txt data in matrix
It doesn't work to, I already try it.It return me error 999
--View this message in context: 
http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028013.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
___users mailing list

[hidden email]
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


If you reply to this email, your message will be added to the discussion below:

http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028015.html

To unsubscribe from Put .txt data in matrix, 
click here.
NAML
View this message in context: 
Re: Put .txt data in matrixSent from the 
Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
___
users mailing listusers@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] Put .txt data in matrix

2013-12-11 Thread simon_37
It doesn't work to, I already try it.
It return me error 999



--
View this message in context: 
http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011p4028013.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Put .txt data in matrix

2013-12-11 Thread Dang, Christophe
Hello, 

 De : simon_37

 [...fscanfMat...]
 It doesn't work to, I already try it.
 It return me error 999

I tried it from the data you gave (copy/paste to a .txt file)
and it worked.

I don't know what error 999 is, it is not in the table
http://help.scilab.org/docs/5.4.1/en_US/error_table.html

Maybe you could send the text file atached so we can see what happens.

Best regards.

-- 
Christophe Dang Ngoc Chan
Mechanical calculation engineer

__

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
__
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Put .txt data in matrix

2013-12-11 Thread Antoine Monmayrant

Le 11/12/13 16:12, simon_37 a écrit :

Hi everybody,


Hi Simon,

Can you send us the raw txt file to see what we can do?
Usually the new csv functions should work, the only difficulty is being 
able to understand how to use the regular expression system to get rid 
of the comments.


Cheers,

Antoine


I want to extract data from .txt in matrix for plot a graphic.
Unfortunaly files .txt have some headers
For example :
Constante de temps : 2Nombre de cycles : 2
  ms
Sensibilité : 100 microV
Tension AC de lecture : 1.00E+3mV
Fréquence AC de lecture : 3.70E+0kHz
A min : -5.00E+0 V
A max : 5.00E+0 V
Pas de tension : 100.00E-3 V
Durée totale du cycle : 150.00E+0 ms
Durée de l'impulsion de tension : 150.00E+0 ms
Commentaires : d:\labview\20131125_161108_LL072
Informations sur la pointe :
Colonnes 1 et 2 : X,Y de AIO, colonnes 3 et 4 : voies X,Y de AI1
/end

0.000   2.848   0.000   0.628
0.100   2.535   0.100   0.733
0.200   3.562   0.200   1.021
0.300   3.111   0.300   0.620
0.400   2.746   0.400   0.693
0.500   2.739   0.500   0.860
0.600   3.001   0.600   1.126
0.700   2.306   0.700   0.967
0.800   2.452   0.800   0.706
0.900   2.551   0.900   1.046
1.000   3.865   1.000   0.966
1.100   2.161   1.100   0.987


I already use the function read or functions mopen and mgetl and it doesn't
work...
I search the mean to begin the read at line number 15 of my file.
I am trap.

Regards
Simon.




--
View this message in context: 
http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
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] Put .txt data in matrix

2013-12-11 Thread Serge Steer

The fscanfMat function should do the job
Serge Steer
- Mail original -
 De: simon_37 simmar...@gmail.com
 À: users@lists.scilab.org
 Envoyé: Mercredi 11 Décembre 2013 16:12:48
 Objet: [Scilab-users] Put .txt data in matrix
 
 Hi everybody,
 
 I want to extract data from .txt in matrix for plot a graphic.
 Unfortunaly files .txt have some headers
 For example :
   Constante de temps : 2Nombre de cycles : 2
  ms
 Sensibilité : 100 microV
 Tension AC de lecture : 1.00E+3mV
 Fréquence AC de lecture : 3.70E+0kHz
 A min : -5.00E+0 V
 A max : 5.00E+0 V
 Pas de tension : 100.00E-3 V
 Durée totale du cycle : 150.00E+0 ms
 Durée de l'impulsion de tension : 150.00E+0 ms
 Commentaires : d:\labview\20131125_161108_LL072
 Informations sur la pointe :
 Colonnes 1 et 2 : X,Y de AIO, colonnes 3 et 4 : voies X,Y de AI1
 /end
 
 0.000 2.848   0.000   0.628
 0.100 2.535   0.100   0.733
 0.200 3.562   0.200   1.021
 0.300 3.111   0.300   0.620
 0.400 2.746   0.400   0.693
 0.500 2.739   0.500   0.860
 0.600 3.001   0.600   1.126
 0.700 2.306   0.700   0.967
 0.800 2.452   0.800   0.706
 0.900 2.551   0.900   1.046
 1.000 3.865   1.000   0.966
 1.100 2.161   1.100   0.987
 
 
 I already use the function read or functions mopen and mgetl and it
 doesn't
 work...
 I search the mean to begin the read at line number 15 of my file.
 I am trap.
 
 Regards
 Simon.
 
 
 
 
 --
 View this message in context:
 http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011.html
 Sent from the Scilab users - Mailing Lists Archives mailing list
 archive at Nabble.com.
 ___
 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