Reading and ploting a notepad txt file on Matlab
Mostrar comentarios más antiguos
I am trying to get the my data read through Matlab and then plot it. but with my code using fscanf and/or textscan the file is being read as one array and taking the data one by one as a character which makes it impossible to plot. It's like each char/integer is an array.here's how my data looks like:
Time Volt Chan 1 chan 2 chan 3 chan 4 chan 5 chan 6 chan7
3333.222 222.33 0.2334 0.3444 0.2233 0.4455 -0.733 0.3333 0.123
3333.222 0.2323 0.4566 0.3456 0.2453 0.4563 -0.753 0.2356 0.233
I want to plot the time data Versus the volts and the other channels separately. Can Anyone help? I know the data looks wrong on here but There's two set of data for each channels.
2 comentarios
Walter Roberson
el 25 de Nov. de 2012
What arguments did you you use for textscan() when you tried?
Mini Me
el 26 de Nov. de 2012
Editada: Walter Roberson
el 14 de Mzo. de 2017
Respuestas (4)
moulay
el 25 de Nov. de 2012
save the data as .txt data. with the load function load filname.txt. befor you do this, you shold comment the title line (the first line. (strg+r)).
now you do this:
% load filename.txt
time=filename(:,1);
volt=filename(:,2);
chanel1=filename(:,3);
and so on.....
plot(time,volt)
Mini Me
el 26 de Nov. de 2012
0 votos
Mini Me
el 27 de Nov. de 2012
0 votos
1 comentario
Vanessa Wen
el 22 de Mayo de 2014
May I know your approach as I face the same problem as you.
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!