Extracting a portion from an array from multiple files

1 回表示 (過去 30 日間)
Tez
Tez 2017 年 7 月 25 日
I have an array(column 197) which is increasing. At one point it starts to decrease. This trend starts repeating many times in array. I extracted only the decreasing portions from that array(column 197) and its corresponding values(column 2) using the following code. How can I apply this code in multiple files? Or what will be the code for extracting only the decreasing portion from multiple file?
d = diff( Col197 .' ); %I assume it is a vector of unknown orientation
mask = d < 0;
goes_down = strfind([0 mask], [0 1]) + 1;
stops_going_down = strfind([mask 0], [1 0]) + 1;
n_seg = length(goes_down);
idx2s = cell(1, n_seg);
seg2s = cell(1, n_seg);
seg3s = cell(1, n_seg);
for K = 1 : n_seg
idx2s{K} = goes_down(K) : stops_going_down(K);
seg2s{K} = Col3(idx2s{K});
seg3s{K} = Col2(idx2s{K});
end
segs23 = [seg2s; seg3s];

回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by