Azzera filtri
Azzera filtri

How to find the starting position of the array from where its value is strictly increasing?

2 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 16 Lug 2012
Modificato: Azzi Abdelmalek il 16 Lug 2012
y=[1 2 5 0 4 2 7 8 9]
%one line command
max([1 max((find(diff(y)<=0))+1)])
  4 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 17 Lug 2012
Modificato: Azzi Abdelmalek il 17 Lug 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

Accedi per commentare.

Più risposte (1)

Walter Roberson
Walter Roberson il 16 Lug 2012
pos = find( diff(YourData) <= 0, 1, 'last' ) + 1;
if isempty(pos); pos = 1; end

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by