How to find the starting position of the array from where its value is strictly increasing?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Azzi Abdelmalek
le 16 Juil 2012
Modifié(e) : Azzi Abdelmalek
le 16 Juil 2012
y=[1 2 5 0 4 2 7 8 9]
%one line command
max([1 max((find(diff(y)<=0))+1)])
4 commentaires
Azzi Abdelmalek
le 17 Juil 2012
Modifié(e) : Azzi Abdelmalek
le 17 Juil 2012
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
Plus de réponses (1)
Walter Roberson
le 16 Juil 2012
pos = find( diff(YourData) <= 0, 1, 'last' ) + 1;
if isempty(pos); pos = 1; end
1 commentaire
Walter Roberson
le 16 Juil 2012
pos = find( [0 diff(YourData)] <= 0, 1, 'last'); %single line version
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!