MATLAB: R[1;-1] how i write the program in matlab for random selection between 1 and -1

MATLAB

need help

Best Answer

V = 1 - 2 * randi([0,1])
or
V = 1 - 2 * (rand >= 0.5)