Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > numpy/matlab compatibility

Reply
Thread Tools

numpy/matlab compatibility

 
 
Matt Funk
Guest
Posts: n/a
 
      01-25-2011
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)

thanks
matt
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-25-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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compatibility Issues -- Windows Media Center and Wireless Adapters =?Utf-8?B?RG91Z2ggRG9jdG9y?= Wireless Networking 2 10-30-2005 11:15 PM
WPA2 backward compatibility with WPA: TKIP and/or AES? =?Utf-8?B?U2NvdCBCYWxmb3Vy?= Wireless Networking 0 10-05-2005 06:15 PM
PreN and G+ Chipset Compatibility =?Utf-8?B?SiZK?= Wireless Networking 1 06-18-2005 03:03 AM
Backward compatibility problem JimD Wireless Networking 3 11-28-2004 05:50 AM
File compatibility? Chris Firefox 0 11-25-2003 03:46 AM



Advertisments