Create binary matrix with some conditions (Matlab)
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!