Bas wrote:
> I am also considering a switch from Matlab to NumPy/SciPy at some
> point.
> 
> Note that in the last version of Matlab (7?) you don't have to use
> 'find', but you now can 'conditional arrays'  as an index, so instead
> of
>   idx=find(a>5);
>   a(idx)=6;
> you can do:
>   cond=a>5;
>   a(cond) = 6;
> or even shorter
>   a(a>5) = 6;
> 
> Does someone know if the same trick is possible in NumPy?
> 

A response I got back from someone else is, yes.  I tested it, and it works in 
numpy.
  You can do:

import numpy
a=numpy.arange(0,10,.1)
a[a>5]=6


                        bb


-- 
-----------------

             [EMAIL PROTECTED]
             http://web.bryant.edu/~bblais

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to