plot the values of two columns of a table

3 views (last 30 days)
Luca cadalo
Luca cadalo on 18 Jun 2017
Edited: dpb on 19 Jun 2017
I have a table with two fields time and velocity every field has several lines and one column I want to plot the results but this command give me an error
plot(Values.time(:,1),Values.velocity(:,1))
the table look like this
time velocity
0 0
0,0100000000000000 8
0,0200000000000000 10
0,0300000000000000 11
0,0400000000000000 6
0,0500000000000000 5
0,0600000000000000 5
Thanks for your time Luca

Answers (1)

dpb
dpb on 18 Jun 2017
Edited: dpb on 19 Jun 2017
Matlab doesn't understand ',' as a decimal point so your data are character array images of the input file, not numeric for the time column.
Try
Values.time(2:end,2)='.'; % convert the ',' to '.' decimal point
Values.time=str2num(Values.time); % now convert them to numeric variables
If that works, then your plot command should work.
If it doesn't, then post the result of executing
whos Values
and
v=Values.Time;
whos v
and we'll be able to see what the data storage form really is.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!