how can i change a position of a matrix to 1?

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

a([2,4,6])=1

1 Comment

thank u....if the positions are random then what will be the code????

Sign in to comment.

Categories

Find more on Random Number Generation in Help Center and File Exchange

Asked:

on 30 Jun 2014

Commented:

on 30 Jun 2014

Community Treasure Hunt

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

Start Hunting!