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!