how to add two matrix
1 次查看(过去 30 天)
显示 更早的评论
hi guys i
采纳的回答
Roger Stafford
2014-10-18
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 个评论
Image Analyst
2014-10-18
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!