Create a Matrix - Replace elements of a Matrix
显示 更早的评论
I want to create a row of a matrix which consist of 16 zeros and random replace 4 of the first 8 elements with ones and 2 of the last 8 elements with ones.
i.e A = [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ;]
Then B= [ 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 ; ]
The ones should be replaced randomly in their positions as explained before.
Any help could be useful.
Thanks in advance !
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Fixed-Point Operator Replacement 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!