help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: assign to infinite a value


From: Richardson, Anthony
Subject: RE: assign to infinite a value
Date: Sun, 28 Oct 2018 18:42:30 +0000

> To: address@hidden
> Subject: assign to infinite a value
> 
> hi
> look that:
> max=50;
> min=-50;
> newArr=[3 4 inf 7 3 2 5 6 inf -inf 9]
> 
> i want to assign to inf value max..and to -inf value -1  ==>[3 4 50 7 3 2 5
> 6 50 -50 9]
> 
> i try this:
> 
> isInf=find(isinf(newArr))
> 
> newArr2(isInf)=max;
> 
> 
> but is not correct beacuse isinf(array) give me index of inf and -inf
> 
> can you write me other method? thank

Try:
        isInf=find(isinf(newArr) &newArr>0)

Tony





reply via email to

[Prev in Thread] Current Thread [Next in Thread]