numpy/matlab compatibility

Discussion in 'Python' started by Matt Funk, Jan 25, 2011.

  1. Matt Funk

    Matt Funk Guest

    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
    Matt Funk, Jan 25, 2011
    #1
    1. Advertising

  2. 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
    Steven D'Aprano, Jan 25, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. siki
    Replies:
    0
    Views:
    936
  2. Luna Moon
    Replies:
    16
    Views:
    1,311
    Giovanni Gherdovich
    Aug 8, 2008
  3. Andrea Ambu

    Fwd: numpy/matlab compatibility

    Andrea Ambu, Jan 25, 2011, in forum: Python
    Replies:
    0
    Views:
    188
    Andrea Ambu
    Jan 25, 2011
  4. someone
    Replies:
    39
    Views:
    1,428
    someone
    May 4, 2012
  5. someone
    Replies:
    5
    Views:
    205
    Marco Nawijn
    Oct 16, 2012
Loading...

Share This Page