Array matching
3 ビュー (過去 30 日間)
古いコメントを表示
I have 2 arrays that i'd like to compare values and create a child that contains matching values (and I'd like to do this the fastest way possible).
Example:
A = [1;0;-1;0;0;0;1]
B = [0;1;-1;0;1;0;1]
child = [0;0;-1;0;0;0;1]
Your help is greatly appreciated! Thank you.
0 件のコメント
回答 (1 件)
Geoff
2012 年 4 月 26 日
child = A;
child(A ~= B) = 0;
参考
カテゴリ
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!