insert zeros into vector
40 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Liron Sabatani
am 14 Apr. 2020
Kommentiert: Stephan
am 14 Apr. 2020
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!
0 Kommentare
Akzeptierte Antwort
Stephan
am 14 Apr. 2020
a = [1 2 3 4 5]
b = zeros(4,numel(a))
result = reshape([a; b],1,[])
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!