How to compare two matrix?
显示 更早的评论
Suppose,
A=[4 5;4 19;5 7;4 5];
B=[4 5]
if B in A
calculation1;
end
else
calculation2;
end
How Can I code this?
采纳的回答
更多回答(1 个)
Juan Ruiz Osorio
2023-4-26
编辑:Juan Ruiz Osorio
2023-4-26
I think this works if you want to do a calculation for each member of B.
A=[4 5;4 19;5 7;4 5];
B=[4 5];
for i=1:size(B,2)
if ismember(B(i),A)
calculation1;
else
calculation2;
end
end
类别
在 帮助中心 和 File Exchange 中查找有关 ANOVA 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!