numpy/matlab compatibility
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Jan 25 16:56:49 EST 2011
On Tue, 25 Jan 2011 13:13:02 -0700, Matt Funk wrote:
> Hi,
>
> i am fairly new to python. I was wondering of the following is do-able
> in python:
>
> 1) a = rand(10,1)
> 2) Y = a
> 3) mask = Y > 100;
> 4) Y(mask) = 100;
> 5) a = a+Y
>
> Basically i am getting stuck on line 4). I was wondering if it is
> possible or not with python?
> (The above is working matlab code)
Not everybody here uses Matlab. Considering that this is a Python list,
not a Matlab list, it may be that the only person who understands what
the above code does is you. (Unlikely, but not *that* unlikely.)
If you want us to help you, you should help us by telling us what the
above code does, and what you've tried (if anything), and what error you
get when you try.
Alternatively, you could try a Matlab forum, and ask for help converting
it to Python there, or much more likely to succeed, a specialist numpy
mailing list. You're very likely to find people with experience in both
numpy and Matlab there.
--
Steven
More information about the Python-list
mailing list