How to use logical indexing to return parts of an array that matches the elements of another array?
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
KSSV
on 25 Jan 2022
Read about findpeaks. It will give you the indices and values of peaks; using the indices you can get yopur required values.
4 Comments
KSSV
on 25 Jan 2022
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
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!