Reputation: 889
I have a data logger that stores the time and the value of a sensor,that looks like:
-'1:06:58' 5.0
-'1:07:00' 6.0
-'1:07:00' 7.0
-'1:07:00' 8.0
-'1:07:00' 9.0
-'1:07:02' 10.9
I retrieve these information in matlab and stored the values in numbers array and the date in cell array my question is how to plot the time versus the values, here is the code I tried
plot (r{1},m)
r{1} is a cell array that has 1 column storing the dates , m is the values of the sensor
`
Upvotes: 0
Views: 833
Reputation: 104464
If the first column of that data you showed is a bunch of strings and the second column is numeric, you can plot the graph using a dummy horizontal data set, and use set
with a combination of the XTick
and XTickLabel
flags. Something like:
A = {'1:06:58', '1:07:00', '1:07:00', '1:07:00', '1:07:00','1:07:02'};
B = [5 6 7 8 9 10.9];
plot(1:numel(B), B);
set(gca, 'XTick', 1:numel(B))
set(gca, 'XTickLabel', A)
I get:
Upvotes: 4