Create matrix with random binary element in matlab

前端 未结 5 870
情歌与酒
情歌与酒 2021-01-11 16:57

I want to create a matrix in matlab with 500 cell (50 row,10 column ), How I can create and initialize it by random binary digits? I want some thing like this in 50*10 scal

5条回答
  •  醉梦人生
    2021-01-11 17:17

    Or you could try it like this:

    A = binornd(ones(50,10),p);
    

    This way you also have the option to control the probability of occurrence of ones.

提交回复
热议问题