I'm trying to make some kind of data filter that goes through a vector, compares every value with the previous one and writes the value in a new vector only if it is bigger than the previous one.
VPo=[0 0 0 0 1 0 2 3 4 0 5 4 3 0 2 1 0 0 0 0];
I wrote this simple loop:
[row, column]=find (VPo == max(VPo));for i=2:row if VPo (i,1) >= VPo (i-1,1) VPoF(i) = VPo(i,1); endend
The problem is that it writes all the values from VPo to VPoF until max(VPo) and doesn't do anything:
VPoF = VPo=[0 0 0 0 1 0 2 3 4 0 5];
Best Answer