How to the index of the member of an array

Discussion in 'MATLAB' started by Onur, Jun 15, 2005.

  1. Onur

    Onur Guest

    Suppose x=[4 3 2 1]

    We want to find the index of the member 2. For example, in the vector
    x, the index of 2 is 3. How can we do this? Thanks.
     
    Onur, Jun 15, 2005
    #1
    1. Advertisements

  2. Onur

    us Guest

    Onur:
    <SNIP wants to <find> the index of a vec-member...

    one of the many solutions

    v=[1 2 4 1 2 3];
    ix1=find(v==1)
    ix2=find(v==4)
    ix3=find(v==5)

    us
     
    us, Jun 15, 2005
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.