How do I find the start and stop indexes of non-zero segments of a matrix?

3 vues (au cours des 30 derniers jours)
Madison Fernandez
Madison Fernandez le 19 Fév 2021
Commenté : Star Strider le 23 Fév 2021
I am trying to find the start and stop indexes of the 6 segments of this graph such that I can use the data within each segment. I had to normalize my graph and when I try to find the start + stop indexes, it does not give me all of them.
Code:
thresholdedSig = forceNorm>0.1;
thresholdedForce = thresholdedSig.*forceNorm;
thresholdIndex = find(thresholdedSig>0);
diffSeg = diff(thresholdIndex);
newSeg = find(diffSeg~=1);

Réponses (1)

Star Strider
Star Strider le 19 Fév 2021
The ischange function could be helpful. A related Signal Processing Toolbox function is findchangepts.
  5 commentaires
Madison Fernandez
Madison Fernandez le 23 Fév 2021
I apologize for the late reply, but thank you! I'll try that out

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by