How do I create random Boolean array with at least one 1 in each row?
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How do I create random Boolean array with at least one 1 in each row?
0 comentarios
Respuestas (1)
James Tursa
el 31 de Mzo. de 2015
Editada: James Tursa
el 31 de Mzo. de 2015
For a row, e.g.,
n = number of random numbers in a row
row = randi(2,1,n)-1;
while( ~any(row) )
row = randi(2,1,n)-1;
end
0 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!