MATLAB: Matrix manipulations of columns

MATLABmatrixmatrix arraymatrix manipulation

How can I replace all even columns of matrix A by columns of ones.
pls note that matrix A is A=random('norm',3,0.2,100,100)
thx

Best Answer

A=random('norm',3,0.2,100,100)
A(:,2:2:end)=ones(size(A(:,2:2:end)))