Insert zeros into matrix in matlab

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 个评论

Can you be more specific? Do you have any conditions that need to be fulfilled to insert the zeroes?

请先登录,再进行评论。

 采纳的回答

B = [A(1); zeros(4,1); A(2)];

1 个评论

I could not find an example anywhere that put it this simply, thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by