2D subtraction from 3D
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Haa Andrew
le 21 Sep 2017
Commenté : Andrei Bobrov
le 21 Sep 2017
I have 3D matrix A=50x60x180 and I want subtract B=50x60 to get same size C=50x50x180? Can anybody use for loop to do this operation?
2 commentaires
John Chilleri
le 21 Sep 2017
C = zeros(50,60,180);
for i = 1:180
C(:,:,i) = A(:,:,i) - B;
end
Is this what you mean?
Réponse acceptée
Andrei Bobrov
le 21 Sep 2017
C = A - B;
or
C = bsxfun(@minus,A,B);
2 commentaires
Walter Roberson
le 21 Sep 2017
The first of those works in R2016b or later but not in earlier versions.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!