I have a time series data which is 46723-by -1. I want to populate another matrix with some specific time series. this is the code i have.
newTime = zeros(); % the new array with 4 columns, each column to have a specified time series
for j = 1:length(time) if time(j) >=7 && time(j) <= 11 newTime(j,1) = time(j) ; elseif time(j) >=56 && time(j) <= 59 newTime(j,2) = time(j) ; elseif time(j) >=99 && time(j) <= 106 newTime(j,3) = time(j) ; elseif time(j) >=133 && time(j) <= 143 newTime(j,4) = time(j) ; endend
Now the above code works fine, however, as you can see the columns of the newTimes has (1,2,3,4) which i want to do in a loop, is there a way to do this?
Best Answer