Clear Filters
Clear Filters

Insert zeros into matrix in matlab

2 views (last 30 days)
I am trying to insert zeros into a matrix, an example is as follows:
[1;2]
to
[1;0;0;0;0;2]
Can anyone please show me how to perform this in matlab?
  1 Comment
Hikaru
Hikaru on 24 Aug 2015
Can you be more specific? Do you have any conditions that need to be fulfilled to insert the zeroes?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 24 Aug 2015
B = [A(1); zeros(4,1); A(2)];
  1 Comment
Atreyu91
Atreyu91 on 25 Aug 2015
I could not find an example anywhere that put it this simply, thank you!

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!