How to compare two matrix?
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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?
0 件のコメント
採用された回答
その他の回答 (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
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Get Started with MATLAB についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!