How to find the starting position of the array from where its value is strictly increasing?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a huge temperature data with 2000 values.
It takes a couple of minutes for thermocouple to stabilize and then it increases steadily. I want to find out the position from which it is strictly increasing.
Thanks
0 件のコメント
採用された回答
Azzi Abdelmalek
2012 年 7 月 16 日
編集済み: Azzi Abdelmalek
2012 年 7 月 16 日
y=[1 2 5 0 4 2 7 8 9]
%one line command
max([1 max((find(diff(y)<=0))+1)])
4 件のコメント
Azzi Abdelmalek
2012 年 7 月 17 日
編集済み: Azzi Abdelmalek
2012 年 7 月 17 日
Walter, it's never empty, it's a concatenation [1 v], if v is empty, the result is not, max([1 v]) will be 1
その他の回答 (1 件)
Walter Roberson
2012 年 7 月 16 日
pos = find( diff(YourData) <= 0, 1, 'last' ) + 1;
if isempty(pos); pos = 1; end
1 件のコメント
Walter Roberson
2012 年 7 月 16 日
pos = find( [0 diff(YourData)] <= 0, 1, 'last'); %single line version
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!