MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Alexander
on 7 Jan 2013

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])

*No products are associated with this question.*

## 0 Comments