How to use logical indexing to return parts of an array that matches the elements of another array?
2 次查看(过去 30 天)
显示 更早的评论
Hi all,
I have two signals 'a" and 'b' (attached) collected at the same time (see figure below). I have identified certain events in signal ''a'' (attached "a_events_frames' and 'a_events_values'/ plotted over signal a in the figure). Now I want:
- Return and save parts of the signal B that corresponds to parts in A between events 1-2, 2-3, 3-4, 4-5, 5-6, 6-7, 7-8
Can you help please?
0 个评论
采纳的回答
KSSV
2022-1-25
Read about findpeaks. It will give you the indices and values of peaks; using the indices you can get yopur required values.
4 个评论
KSSV
2022-1-25
b(a_indices)
The above line will give you values in b at the indices a_indices. It will not give you indices from b. Already you have indices a_indices.
If you know the indices of peaks 1,2,3,etc. You can get the values betweent he peaks using:
a(id1:id2) % id1 is index of peak1, id2 is index of peak 2
a(id2:id3) % id2 is index of peak2, id3 is index of peak 3
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!