how to add zeros to the beginning and end
조회 수: 15 (최근 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)];
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!