Check for array equality?

1 view (last 30 days)
Bob Whiley
Bob Whiley on 3 Feb 2015
Commented: Bob Whiley on 4 Feb 2015
How can I check if indices of three arrays are equal and make those indices all zero if they are equal.
  2 Comments
James Tursa
James Tursa on 3 Feb 2015
Please provide a short example of your request. E.g., give three arrays and the desired output.
Bob Whiley
Bob Whiley on 4 Feb 2015
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.

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 4 Feb 2015
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

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!