Creating array using other arrays and logical conditions.
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!