Wrong output of ismember command
Show older comments
Dear all,
In part of my code I am using ismember command and as the array I am using has 21*9 shape and all of these elements are in the first element I expected an array of 21*9 members to be my out put while the output has shape of 22*9! Any idea about the cause? Please find my code in the following. I found the rows having same value in the 9th column in all_com variable and then used idx commands to find the rows corresponding to that.
Thank you in advance.
in1=load('in1.mat')
in2=load('in2.mat')
out1=load('out1.mat')
out2=load('out2.mat')
all_common= intersect(intersect(intersect(in1(:,9), in2(:,9)), out1(:,9)), out2(:,9));
idx1 = ismember(in1(:,9),all_common);
in1_com = in1(idx1,:);
idx2 = ismember(in2(:,9),all_common);
in2_com = in2(idx2,:);
idx3 = ismember(out1(:,9),all_common);
out1_com = out1(idx3,:);
idx4 = ismember(out2(:,9),all_common);
out2_com = out2(idx4,:);
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!