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!

 Respuesta aceptada

Stephan
Stephan el 14 de Abr. de 2020

6 votos

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

2 comentarios

Liron Sabatani
Liron Sabatani el 14 de Abr. de 2020
thank you king!
Stephan
Stephan el 14 de Abr. de 2020
Did you notice that you can accept and or vote for useful answers?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 14 de Abr. de 2020

Comentada:

el 14 de Abr. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by