Interval where values are greater than treshold
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Lucas Russi
am 10 Dez. 2019
Kommentiert: Lucas Russi
am 10 Dez. 2019
Hi everyone
Logic = Data > Treshold
I now need to know what the intervals are where the treshold is exceeded
Logic = [1 1 1 0 0 0 1 1 0 1]
Desired_Output = [1 3;7 8;10 10]
So - from 1 to 3, from 7 to 8 aswell as 10
I can't think of a good way to do this.
Thank in advance
0 Kommentare
Akzeptierte Antwort
Stephen23
am 10 Dez. 2019
>> B = find([true;diff(Logic(:))>0]);
>> E = find([diff(Logic(:))<0;true]);
>> M = [B,E]
M =
1 3
7 8
10 10
Siehe auch
Kategorien
Mehr zu MATLAB Report Generator finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!