MATLAB Answers


Plotting selected data from time series

Asked by Pankaj
on 20 Jul 2017
Latest activity Edited by alice
on 20 Jul 2017
Say ts is a timeseries object with three data colums. Storing min temperature, max temperature and humidity. I am interested in just plotting min and max temperature. How can I get it done?
I need something like plot(ts(:, 1:2)) ( I know this won't work)


Sign in to comment.

1 Answer

Answer by alice
on 20 Jul 2017
 Accepted Answer

If you want to plot the time versus the min temperature and the time versus the max temperature and if your min temperature is on the first column of the data of your timeseries and the the max temperature in the second, then access those and plot them:
plot(ts.time,,1), ts.time,,2));


ts.time produces numeric values. I want to avoid the lengthy way. Any other suggestions?
on 20 Jul 2017
You can adapt it so you don't plot the time:
figure; hold on; grid on;
The documentation would have helped you, you could try reading doc plot and doc hold.

Sign in to comment.