Reputation: 99
I've a problem to find common elements between all columns of a matrix in MATLAB, I've tried to solve it my self, the basic problem is intersect function set intersect just between two matrices, so I wrote a code like this
A=randi(n,m);
B=struct();
for k=1:size(A,2)-1
B.(['b' num2str(k)])=intersect(A(:,k),A(:,k+1));
end
unfortunately the problem isn't solve cause the dimension of A is unknown so we have same problem with B! thanks all.
Upvotes: 3
Views: 241