Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: I am sure matlab has a function for this...
Date: Wed, 20 Feb 2008 11:44:13 -0500
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fphlct$bnv$1@fred.mathworks.com>
References: <5641f3e2-ce50-49f3-bf58-b76fb1f0f59c@s37g2000prg.googlegroups.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1203525853 12031 144.212.105.187 (20 Feb 2008 16:44:13 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 20 Feb 2008 16:44:13 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
Xref: news.mathworks.com comp.soft-sys.matlab:452681




"Ross" <fed.rossi@gmail.com> wrote in message 
news:5641f3e2-ce50-49f3-bf58-b76fb1f0f59c@s37g2000prg.googlegroups.com...
> Hi,
>
> Sorry for the naive question:
>
> Let V be a vector as follows:
>
> P = [ 4 0 3 9 7 0]'
>
>
> I would like to know how I can get (with the most efficient method)
>
> f = [ 3 1 2 5 4 1]
>
> i.e. the position of each element of P in unique(P);

Look at the three-output syntax described in the M-file help for UNIQUE.

-- 
Steve Lord
slord@mathworks.com