how to insert rows and colums of zeroes in this matrix ??? a=[1 2 3;4 5 6]

 Accepted Answer

Here is one quick way to interlace columns and rows of zeros:
>> a=[1 2 3;4 5 6];
>> b = zeros(2*size(a));
>> b(1:2:end,1:2:end) = a
b =
1 0 2 0 3 0
0 0 0 0 0 0
4 0 5 0 6 0
0 0 0 0 0 0

More Answers (0)

Categories

Tags

Asked:

on 27 Jan 2016

Edited:

on 27 Jan 2016

Community Treasure Hunt

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

Start Hunting!