How do I create random Boolean array with at least one 1 in each row?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
How do I create random Boolean array with at least one 1 in each row?
0 Kommentare
Antworten (1)
James Tursa
am 31 Mär. 2015
Bearbeitet: James Tursa
am 31 Mär. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!