MATLAB: How can i change a position of a matrix to 1

matrixmatrix manipulation

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

Best Answer

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