how to add zeros to the beginning and end
38 次查看(过去 30 天)
显示 更早的评论
how to add zeros to the beginning and end
a = [1 3 5];
%result
a = [0 0 1 3 5 0 0];
0 个评论
回答(1 个)
James Tursa
2020-3-3
Lots of ways to do this. Depends on how many zeros you want. E.g.,
a = [0 0 a 0 0];
Or,
m = 2;
n = 2;
a = [zeros(1,m) a zeros(1,n)];
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!