insert zeros into vector

조회 수: 8 (최근 30일)
Liron Sabatani
Liron Sabatani 2020년 4월 14일
댓글: Stephan 2020년 4월 14일
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
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개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by