how to add two matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Réponse acceptée
Roger Stafford
le 18 Oct 2014
Let 'a' and 'b' be two row vectors. To add zeros to the left side of the shorter one so as to have equal lengths do this:
na = length(a);
nb = length(b);
n = max(na,nb);
a2 = [zeros(1,n-na),a];
b2 = [zeros(1,n-nb),b];
4 commentaires
Image Analyst
le 18 Oct 2014
Can you go ahead and officially "Accept" his answer and also "vote" for it to give him credit/reputation points for it? Thanks in advance.
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!