How to insert zeros in matrix randomly?
显示 更早的评论
I have this matrix:
A =
[2, 1, 4, 6, 2;
9, 4, 6, 1, 2;
5, 3, 2, 8, 3;
7, 2, 1, 9, 3;
7, 1, 8, 2, 4]
I try to insert zeros in each row so the matrix should looks like this:
A=[2, 0, 1, 4, 6, 0, 2;
9, 4, 0, 6, 0, 1, 2;
5, 3, 2, 0, 8, 0, 3;
7, 0, 2, 1, 0, 9, 3;
7, 1, 8, 0, 2, 0, 4]
In this case zeros should be inserted in between maximum of 4 digits for all rows. Any idea on how to do it?
2 个评论
KL
2017-11-7
In this case zeros should be inserted in between maximum of 4 digits for all rows...
What do you mean by that?
Hajem Daham
2017-11-7
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Arithmetic Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!