Array matching
조회 수: 1 (최근 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에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!