I have an array of coeffecients [a1,a2,a3,...,an]
and I want to insert 4 zeros between each one.
the wanted result: [a1,0,0,0,0,a2,0,0,0,0,a3,0,0,0,0,...,0,0,0,0,an]
thank's for help!

 採用された回答

Stephan
Stephan 2020 年 4 月 14 日

6 投票

a = [1 2 3 4 5]
b = zeros(4,numel(a))
result = reshape([a; b],1,[])

2 件のコメント

Liron Sabatani
Liron Sabatani 2020 年 4 月 14 日
thank you king!
Stephan
Stephan 2020 年 4 月 14 日
Did you notice that you can accept and or vote for useful answers?

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

その他の回答 (0 件)

カテゴリ

質問済み:

2020 年 4 月 14 日

コメント済み:

2020 年 4 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by