I have a rather simple task. I just simply need to do something like that
plot(stampy{1:5},data{2}(1:5))
However, with stampy{1:5} I have five separate ans and data{2}(1:5) seems to be alright for plotting. i have tried to loop smth like that
cc=zeros(1,10);
for i=1:10
cc(i) = stampy{i}
end
But it did not work. I don't know, it seems to be a very simple task. Can anybody suggest the solution ? I have data in this form:
>> stampy{1:5}
ans =
21-Sep-2016 05:52:00
ans =
21-Sep-2016 05:53:00
ans =
21-Sep-2016 05:54:00
ans =
21-Sep-2016 05:55:00
ans =
21-Sep-2016 05:56:00
and
>> data{2}(1:5)
ans =
-32.3750
-25.0000
-25.0000
-25.0000
-25.0000
You can use datenum
to convert each of your dates to a date number and use this as the x axis. You can then use datetick
to specify the format to use for your tick marks. This has the benefits that it works on most any version of MATLAB and it handles non-uniformly spaced dates.
plot(datenum(stampy), data{2}(1:5))
datetick('x', 'HH:MM:SS')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With