Change matrix bits depending on the rate (Matlab)
Show older comments
Dear members
I have matrix A of dimensions s1*s2 where the number of ones in each column and row is equal
And I have to write a program that verify if the final bits depending on the rate are 0 or 1. If final bits depending on the rate is 0, I have to make permutation between rows and columns in order to obtain final bits 1 not 0 and save the equal number of ones in each row and column.
For example : I have a matrix 5*10, so the rate is 5/10=1/2 and the number of ones in each row is 6 and in each column is 3

The final bit depending on the rate 1/2 in the first row is 0, so here I have to make permutation between rows and columns to obtain 1 in place of 0 and the number of ones in each row and columns still the same. We obtain this matrix finally :

I tried to program the first part that calcul the rate of the matrix like that:
[s1, s2] = size(A);
d = gcd(s1, s2);
n1 = s1 / d;
n2 = s2 / d;
Can you help me to program the permutation please.
4 Comments
Jan
on 21 May 2021
I read the text 3 times and do not understand, what this means: "verify if the final bits depending on the rate are 0 or 1." What is a "final bit"? How does a bit depend on which rate? What exactly is "permutation between rows and columns"?
This is not celar to me also: "final bit depending on the rate 1/2 in the first row is 0, so here I have to make permutation between rows and columns to obtain 1 in place of 0"
Afluo Raoual
on 21 May 2021
Jan
on 21 May 2021
I still do not understand, what "permutation between rows and columns" means. Do you exchange some transposed columns with rows or the other way around? Do you want to permute the elements of a specific row and column? Do you want to change the order of rows and/or columns? Should the permutation randomly or do you want to swap the specific value with any (or the last) matching different value of the row (or column)?
Afluo Raoual
on 21 May 2021
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!