Info
此问题已关闭。 请重新打开它进行编辑或回答。
checking conditions on 2 arrays
3 次查看(过去 30 天)
显示 更早的评论
I have 2d array X of size (750, 450) and another array Y of size(750, 450).
I want to check where there is 0 in X, if there is also 0 in Y.
any one liners?
0 个评论
回答(1 个)
Walter Roberson
2018-2-6
mask = ~X & ~Y;
this will be true only in places where X and Y are both exactly 0.
You might prefer to code
mask = (X == 0) & (Y == 0);
and indeed you need that if your arrays might have nan in them as the ~ operator does not work on nan.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!