MATLAB: A command like “unique” for matrices

commandMATLABmatricesunique

Hi guys,
Is there any command like "unique" for matrices?
I have a major matrice (mother) , and that involve few minor matrices, some of are repeated randomly
i'm looking for a command for delete repeated ones and do something like unique ,
anybody knows how?

Best Answer

A general solution that does not concatenate the data and works for any size arrays:
% Fake data:
A = [1;2;3];
B = [1;2;3];
C = [4;5;6];
R = {A;B;C}
% Method:
N = numel(R);
X = false(1,N);
for ii=2:N
Y=false;
for jj=1:ii-1
Y = Y || isequal(R{ii},R{jj});
end
X(ii) = Y;
end
R(X) = []