how can i change a position of a matrix to 1?
Show older comments
i have a matrix a=rand(1,10). now i want to change 2,4,6 position of matrix to 1.
how can i do that....
plz plz plz help me
Accepted Answer
More Answers (1)
Andrei Bobrov
on 30 Jun 2014
a = rand(10,1);
a(randperm(10,3)) = 1;
1 Comment
suchismita
on 30 Jun 2014
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!