finding elements in a matrix`
1 回表示 (過去 30 日間)
古いコメントを表示
I have a a matrix A= [1 3 10; 1 8 10; 2 4 9] and an array x = [2 9]. i want to check if x is present in a single row of A. In this case it is true, so continue. Can anyone help? TIA.
0 件のコメント
採用された回答
Azzi Abdelmalek
2016 年 8 月 16 日
編集済み: Azzi Abdelmalek
2016 年 8 月 16 日
A= [1 3 10; 1 8 10; 2 4 9]
x=[ 2 9]
for k=1:size(A,1)
idx=all(ismember(x,A(k,:)));
if idx
break
end
end
idx
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!