[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stupid New User Question
From: |
Muthiah Annamalai |
Subject: |
Re: Stupid New User Question |
Date: |
Thu, 13 Jul 2006 10:47:07 -0700 (PDT) |
Hi there,
If you looked into the nice code in octave .m files
which come with the distribution at
/usr/share/octave/$VERSION/m/scripts/
youd get a nice idea of how to write great functions.
For making this code work with arrays you just need
to use the find() function.
function retval = killnegatives(x)
retval = x;
%if(retval<0) retval = 0;
negatives=find(retval<0);
retval(negatives)=0;
endfunction
Cheers
Muthu
and placed it in a file called "killnegatives.m".
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com