Creating array using other arrays and logical conditions.
古いコメントを表示
Hi, why does the below code return
Z = 0 0 0 0 1
X = [ -1 -2 3; -4 -5 -6];
Y = [ 3 3 3 ; 2 2 2];
M = ones(100);
Z (X > 0 & Y == 3) = M(X > 0 & Y ==3)
Only positive entry in X is at (1,3) position and Y = 3 at the first row of Y, so I expected something like 1 1 1 as the output.
I will appreciate if anyone can explain this to me, point me towards some tutorials about creating arrays in this way.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!