필터 지우기
필터 지우기

Array matching

조회 수: 7 (최근 30일)
Trader
Trader 2012년 4월 26일
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.

답변 (1개)

Geoff
Geoff 2012년 4월 26일
child = A;
child(A ~= B) = 0;
  댓글 수: 9
Geoff
Geoff 2012년 5월 2일
Hey it even fooled me... I was under a bit of pressure and lost my sense of humour for a couple of days. =)
Jan
Jan 2012년 5월 2일
I frequently confuse humor and humerus. Therefore I thank you for your clarifications.
Is the OP still interested in the solution?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by