|
Instead of NaN, use Inf.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
If you ever post asking for help again, please bear in mind that you
need to
reduce your code so as to be easily readable. I have no idea of the
structure of p_min_b from what you have posted. In the future, try to
limit your
example code to 3x3 matrices and format the text so it is easy to read.
Also, when you say "circle" I think you mean "loop". If so, learn
programming
first. Just a bit of correct terminology goes a long way.
Luca wrote:
> Good idea: this is the program:
>
> clear all, close all, clc
> p_min_b =3D [0 0 0 0 0 0 0 180.08 0 0 0 179.87 0 0 0 0 0 0 179.57 0
> ...
>
> 0 0 179.41 0 0 0 0 179.56 0 0 0 179.6 0 179.7 0 0 0 178.84 0 178.66...
>
> 0 0 178.6 0 0 178.53 0 0 178.43 0];
> % I divide the row arrey in 20 + 20 + 10 data points because is esier
> to see it
> % I wont to erase the values higher than 179.41 (data 179.56, 179.6,
> 179.7) that correspond to
> % p_min_b colomn 28, 32, 34
>
> non_zero=3Dfind(p_min_b) % this find the colomn values different to 0
>
> %the answer is
>
> % non_zero =3D
> %
> % 8 12 19 23 28 32 34 38 40 43 46
> 49
>
> % now I say to take this colomn values and compare with the values
> before.
> % If it's larger put NaN.
> long_non_zero=3Dlength(non_zero) % this give the length of the non_zero
> row vector.
>
> % this is usefull for the for cicle for stop it in the end.
>
> for i=3D2:long_non_zero
> if p_min_b(non_zero(i)) >=3D p_min_b(non_zero(i-1))
> p_min_b(non_zero(i))=3D NaN
> end
> end
>
> %the answer is
>
> % p_min_b=3D[0 0 0 0 0 0 0 180.08 0 0 0 179.87 0 0 0 0 0 0 179.57 0 ...
> %
> 0 0 179.41 0 0 0 0 NaN 0 0 0 179.6 0 NaN 0 0 0 178.84 0 178.66 ...
> % 0 0 178.6 0 0 178.53 0 0 178.43 0]
>
> % like you can see don't erase the value 179.6
> % If I chose 0 it will erase every number
> % If I chose to put the same value of the step before and after erase
> it
> % whit an other for loop it will have the same problem. It will not
> erase
> % the second value
>
>
> Steve Amphlett wrote:
> >
> >
> > J=E9r=F4me wrote:
> >>
> >>
> >> Luca wrote:
> >>
> >>> Thanks but this create a vector erasing the NaN values.
> >>> You know how consider two NaN equal?
> >>
> >> Hi,
> >>
> >> it could be easier if you post a small example !
> >
> > Or just type in the whole homework question verbatim.
|