help-octave
[Top][All Lists]
Advanced

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

Re: Filtering a Matrix


From: Quentin Spencer
Subject: Re: Filtering a Matrix
Date: Thu, 30 Aug 2007 09:38:54 -0500
User-agent: Thunderbird 2.0.0.5 (X11/20070719)

James Sherman Jr. wrote:
When you execute
Z = 0.07;
You reassign your matrix to just an scalar value. What I think you want is:

i=find(Z>= 0.07);


Z(i)=0.07;

j=find(Z<0.0375);

Z(j)=0;


That works, but this does it faster:

Z(Z>=0.07)=0.07;
Z(Z<0.0375)=0;

On a matrix this size, it probably doesn't make much difference, but it would be noticeable if the matrix were very large, or the operation were repeated many times.

Quentin



reply via email to

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