%% Unique Values and Their Indices
% Define a vector with a repeated value.

A = [9 2 9 5];

%
% Find the unique values of A and the index vectors ia and ic, such that C = A(ia) and A = C(ic).

[C, ia, ic] = unique(A)

% Copyright 2012 The MathWorks, Inc.