code that generate 50 by 50 matrix of 0's and 1's of which 20% is 1's.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kelil Mohammed
am 11 Jun. 2018
Bearbeitet: Stephen23
am 12 Jun. 2018
I want to create matrix of 0's and 1's of which 20% of the elements of the matrix is 1's. The following the code I tried. neighbor_matrix = [ones(10,50);zeros(40,50)]; But the out come is not in the way I want. I want the distribution shouldn't be 1's and 0's are in separate manner. Thank you.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Matt J
am 11 Jun. 2018
neighbor_matrix = [ones(10,50);zeros(40,50)];
neighbor_matrix(:)=neighbor_matrix(randperm(2500));
0 Kommentare
Siehe auch
Kategorien
Mehr zu Antennas, Microphones, and Sonar Transducers 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!