Create binary matrix with some conditions (Matlab)
Afficher commentaires plus anciens
I have this matrix of dimensions (6x12)
H=[1 1 1 1 1 1 0 0 0 0 0 0;
0 0 0 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 1 0 0 0 0;
0 0 0 0 0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 0 0 0 0 1]
The first row must still as it is (1 1 1 1 1 1 0 0 0 0 0 0)
1) As a first condition, I want change the second row in order to get it (0 0 0 1 0 0 0 1 1 1 1 1) it means we change the zeros from 8 to 12 column of the second row to ones.
2) As a second condition, from the third to sixth row I must add ones in order to get a matrix with 6 ones in each row and 3 ones in each column without changing the place of ones of this initially matrix.
Anyone can help please
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!