MATLAB: Find matched data (place of equal values)

find place of equal valuesmatch data

how i can find matched cells in two columns with accept multi matches for any cell.
the data is:
i use this code:
for j=1:length(defs)
querymdr=data2(:,1); # quermdr 5*1 cells
y=alldata(:,1); % y 37*1 cells
ind=find(y==querymdr) ;
record= alldata(idx,:);
% record=[alldata{idx(1),:}];
for k=2:length(idx)
record = [record,(alldata(idx(k),6))];
data1(j,:)=record;% put combined record into result table
it gives me an error in
ind= find(y==querymdr) ;
with a message "Undefined function 'eq' for input arguments of type 'cell'. " what i can do ?
any help please…!

Best Answer

  • a1 = cat(1,querymdr{:});
    a2 = cat(1,alldata{:,1});
    ii = ismember(a2,a1);
    record = [alldata{ii,6}];