[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stupid New User Question
From: |
Paul Kienzle |
Subject: |
Re: Stupid New User Question |
Date: |
Tue, 11 Jul 2006 21:04:39 -0400 |
On Jul 11, 2006, at 5:37 PM, Pat Ferguson wrote:
I have written a simple function:
function retval = killnegatives(x)
retval = x;
if(retval<0) retval = 0;
endif;
endfunction
and placed it in a file called “killnegatives.m”.
The function name is longer than the expression itself, but here you go:
function x = killnegatives(x), x(x<0) = 0; end
There is also the clip function on octave-forge:
clip(x,[0,inf])
- Paul