Finding segments of data using time stamps in one column to the corresponding data in another column of the same matrix. Output each segment of data into separate matrix row or cell array
2 views (last 30 days)
Show older comments
Hi,
I am trying to find segments of data from intervals of start and stop times. The data is a matrix with data in the first column and time stamps in the second column that correspond to the interval times. I would like to get the data in the first column that corresponds to the time stamps in the second column. I would also like the out put interval (there are multiple intervals, in the samples I provided there are 3) to be that each segment is in a separate matrix row or column or even cell array (any is find I just want them to be separate). I have tried some code but am getting empty cell array outputs:
for i=1:numel(interval(:,1))
w=interval(i,:);
output{i}=intersect(data(find(data>=w(1))),data(find(data<=w(2))));
end
I have attached an example of data in a matrix data and intervals in matrix interval. Any help would be wonderful.
0 Comments
Answers (0)
See Also
Categories
Find more on Workspace Variables and MAT-Files 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!