MATLAB: Matrix value change with conditions (x=y*(mask==1))

MATLABmatrix manipulation

I have two matrix x,y and mask.
x = [1,1,1,1;...
2,2,2,2;...
3,3,3,3;...
4,4,4,4];
y = [5,5,5,5;...
5,5,2,5;...
5,5,5,5;...
5,5,5,5];
mask = [0,0,0,0;...
1,1,1,1;...
0,0,0,0;...
1,1,1,1];
When try perform this:
x=y*(mask==1)
Result is:
x =
10 10 10 10
10 10 10 10
10 10 10 10
10 10 10 10
Why?

Best Answer

(* performs matrix multiplication) perhaps you needed .* element wise multiplication