필터 지우기
필터 지우기

Check for array equality?

조회 수: 2 (최근 30일)
Bob Whiley
Bob Whiley 2015년 2월 3일
댓글: Bob Whiley 2015년 2월 4일
How can I check if indices of three arrays are equal and make those indices all zero if they are equal.
  댓글 수: 2
James Tursa
James Tursa 2015년 2월 3일
Please provide a short example of your request. E.g., give three arrays and the desired output.
Bob Whiley
Bob Whiley 2015년 2월 4일
Its not for a specific example, its more like a function where I would have 3 arrays and then would check it. Like [1,2,3;4,5,6] and [1,3,6;6,3,7] and [1,2,5;9,8,7]. But those dimensions and numbers could be anything so the solution would have to work in general.

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

채택된 답변

John D'Errico
John D'Errico 2015년 2월 4일
Not sure what the problem is. Why not just this?
ind = (A==B) && (A == C);
A(ind) = 0;
B(ind) = 0;
C(ind) = 0;
If this is not the answer, then you need to explain yourself FAR more clearly.
John
  댓글 수: 1
Bob Whiley
Bob Whiley 2015년 2월 4일
This is perfect! Thank you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by