MATLAB: Chaging the outupt integers

matrix output

I have a code here
M=256;
N=256
A=fix(2*rand(M,N));
And right now the output either is zero or one. Well I want the output to be either 1 or -1. Can anyone help me as to how to change this. Thank you, I'm quite new to matlab.

Best Answer

M=256;
N=256
A=fix(2*rand(M,N));
A(A==0)=-1