insert zeros into vector

40 次查看(过去 30 天)
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
a = [1 2 3 4 5]
b = zeros(4,numel(a))
result = reshape([a; b],1,[])
  2 个评论
Stephan
Stephan 2020-4-14
Did you notice that you can accept and or vote for useful answers?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by