Segmenting a vector into multiple vectors based on the time stamps
Show older comments
Hi,
I have a vector of data [3000 1] and another vector that shows events (time stamps). I'd like to split the vector into multiple segments based on the time stamps (from point 1 to 2, from 2 to 3, from 3 to 4...and so on). The events are not equal length. I tried to work on it on my own, but it didn't work. Can someone help me with this?
for j = 1:length(v)-1;
b = v(hit_idx(j):hit_idx(j+1));
Vs = mat2cell(v,b);
end
2 Comments
Turlough Hughes
on 2 Dec 2019
Could you upload the two variables as a .mat perhaps or provide code to replicate the data?
Masahiro Yamada
on 2 Dec 2019
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!