MATLAB: Generating a random binary matrix

binarymatrixrandomly

Hello,
I want to generate randomly a (nxm) matrix of binary variables (0 and 1) in matlab. Is there someone who has a suggestion? Thanks.

Best Answer

A = randi([0 1], n,m)