Basic comparison between columns
Show older comments
Hello all,
Let's say I have a 10 x 10 matrix filled with numbers (10 x 10 double). When the value 999 is found (anywhere) the value in the row on the right-hand side must be 9 or it's an error. I would have thought that:
if Z(:,1:end) == 999 & Z(:,2:end)~=9
disp('error)
return
end
would work but it doesn't.
Any ideas? Thank you
1 Comment
the cyclist
on 12 Apr 2017
Edited: the cyclist
on 12 Apr 2017
When you say "right-hand side", do you mean the element just the right of each occurrence of 999 needs to be equal to 9, or that 9 needs to be in the right-most column of the matrix?
How should it be handled if 999 is in the right-most column?
Accepted Answer
More Answers (0)
Categories
Find more on Simscape Electrical 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!