>> A = {[1,2,3,4],[4,2,3],[1,2,5,6,78,9],[1,2,3,4],[1,2,5,6,78,9],[4,2,3],[5,6,7]};
>> N = numel(A);
>> X = false(N,N); % find which arrays are the same:
>> for ii=1:N, for jj=1:ii, X(ii,jj)=isequal(A{ii},A{jj}); end, end
>> Y = X & cumsum(X,1)==1 & cumsum(X,2)==1; % indices that ignore duplicates.
>> Z = A(any(Y,1));
>> Z{:}
ans =
1 2 3 4
ans =
4 2 3
ans =
1 2 5 6 78 9
ans =
5 6 7
2 Comments
madhan ravi (view profile)
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/454139-omit-same-element-inside-cell#comment_689395
Naime (view profile)
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/454139-omit-same-element-inside-cell#comment_689400
Sign in to comment.