How to use logical indexing to return parts of an array that matches the elements of another array?

6 vues (au cours des 30 derniers jours)
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?

Réponse acceptée

KSSV
KSSV le 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 commentaires
Tomaszzz
Tomaszzz le 25 Jan 2022
Modifié(e) : Tomaszzz le 25 Jan 2022
Yes, they are recorded at the same time stamps. What you said is where I fail so this:
signal b(a_indices)
returns values of b at correct indices but not indices of b itself. Also, even if I get indices of b how to return elements of b between indices 1 and 2, 2and 3 and so on?
KSSV
KSSV le 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

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by