MATLAB: Help!!!!!!!! How to replace all the zeros in an array with -1

cdmaMATLABpn sequencewireless communication

X = [1 0 0 0 1 0 0 1 1 0 1 0 1 1 1] i want to replace all zeros with -1 in array. anybody can help ?

Best Answer

X(X==0) = -1 ;