how to add zeros to the beginning and end

35 ビュー (過去 30 日間)
grandong oblong
grandong oblong 2020 年 3 月 3 日
コメント済み: grandong oblong 2020 年 3 月 3 日
how to add zeros to the beginning and end
a = [1 3 5];
%result
a = [0 0 1 3 5 0 0];

回答 (1 件)

James Tursa
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)];
  1 件のコメント
grandong oblong
grandong oblong 2020 年 3 月 3 日
Ok thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by