find matched data (place of equal values) ?
1 次查看(过去 30 天)
显示 更早的评论
how i can find matched cells in two columns with accept multi matches for any cell.
the data is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150113/image.jpeg)
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))];
end
data1(j,:)=record;% put combined record into result table
end
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...!
0 个评论
采纳的回答
Andrei Bobrov
2015-5-15
a1 = cat(1,querymdr{:});
a2 = cat(1,alldata{:,1});
ii = ismember(a2,a1);
record = [alldata{ii,6}];
3 个评论
Walter Roberson
2015-5-15
The only difference between cat(1,querymdr{:}); and the [querymdr{:}] that I suggested earlier is that the cat(1) produces a column vector and the form I used creates a row vector.
更多回答(1 个)
Walter Roberson
2015-5-15
What you do is you stop posting the same material and you use the solution I already gave in your previous topic
8 个评论
Walter Roberson
2015-5-15
When working with a cell array, one has to know the class() and size() of the entries in the array as well.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!