MATLAB: How to form a matrix from a given condition

matrix

I want a 24*5 matrix which have only 1,-1,&0 values

Best Answer

randi([-1 1], 24, 5)