How can I shrink the domain of a time series plot?

1 view (last 30 days)
I have a time series object that has a start date and time of
2012-06-26 17:21:00
which increases incrementally by 'minutes' to
2012-06-26 19:21:00
when I plot the object, the plot extends from the start data/time to the end date/time. How can I modify the x limits so that I can create daily plots?
I tried the code below but it seems that index values assigned in the for loop do not match the index values the time series plot is using.
CR1000_num = importfileCR1000_num('CR1000_Main_2012_06_26_to_2012_09_24.dat');
CR1000_dates = importfileCR1000_dates('CR1000_Main_2012_06_26_to_2012_09_24.dat');
% TIME SERIES OBJECT 1: Avg Temp
ts_CR1000_temp = timeseries(CR1000_num(:,19));
ts_CR1000_temp.Name = 'Average Temperature';
ts_CR1000_temp.DataInfo.Units = 'Deg C'
ts_CR1000_temp.TimeInfo.Units = 'minutes';
ts_CR1000_temp.TimeInfo.StartDate = CR1000_dates{1,1:end}
ts_CR1000_temp.TimeInfo.Format = 'mmm dd, yy'
x1 = '"2012-06-26 17:21:00"'
x2 = '"2012-06-26 19:21:00"'
for i = 1:length(CR1000_dates)
if strcmp(x1,CR1000_dates{i,1:end})
x_lower = i
end
if strcmp(x2,CR1000_dates{i,1:end})
x_upper = i
end
end
plot(ts_CR1000_temp)
xlim([x_lower,x_upper])

Answers (0)

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!