I have an array which is increasing. At one point it starts to decrease. This trend starts repeating many times in array. How to extract only the decreasing portion from that array?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tez
am 9 Jul. 2017
Kommentiert: Walter Roberson
am 25 Jul. 2017
I have an array which is increasing. At one point it starts to decrease. This trend starts repeating many times in array. How to extract only the decreasing portions from that array and plot another array values which corresponds to that decreasing portion?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 9 Jul. 2017
d = diff( YourArray(:).' ); %I assume it is a vector of unknown orientation
goes_down = strfind([0 d>0], [1 0]) + 1;
stops_going_down = strfind([0 d<0], [1 0]);
n_seg = length(goes_down);
segs = cell(1, n_seg);
for K = 1 : n_seg;
segs{K} = YourArray(goes_down(K) : stops_going_down(K));
end
7 Kommentare
Walter Roberson
am 25 Jul. 2017
When you process the multiple files, at each step do you want to forget about the previous file (except perhaps for the plot that has been drawn), or at each step do you want to add on to the seg2s / seg3s arrays so that you end up with one long cell array of those that includes all of the files, or do you want to use a cell array wrapping around each of those so that you can index into the cell array to get the seg2s / seg3s relevant to that file, or ....?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Large Files and Big Data 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!