Create similar matrices from another matrix
Afficher commentaires plus anciens
Hello everyone could anyone help me for my problem... I have two original matrices say amatrix and bmatrix that should be separated to four matrices say , each original matrix converted to 2 matrices. For example amatrix converted to c1h1 and c2h1. But bmatrix will converted to c1h2 and c2h2. The first condition here is c1h1 and c1h1 should be similar as much as we can. and the same for c2h1 and c2h1.the second condition that each matrix doesn't have more than 10 number and we shouldn't select single number to assign but entire row. For example.: amatrix =[5 5 0 0 0 0;6 1 0 0 0 0;2 2 2 2 2 2]; bmatrix =[5 5 0 0 0 0 0;5 1 5 0 0 0 0;2 2 2 2 4 6 6; 6 6 6 6 1 1 0] The expected solution is C1h1=[5 5 ;6 1] C1h2=[5 5 0 0 0 0;6 6 6 6 1 1] C2h1 =[2 2 2 2 2 2] C2h2=[2 2 2 2 4 6 6; 5 1 5 0 0 0 0] may be another solution is feasible. note it's not important to select every row have same number it's enough to have same number in c1h1 and c1h2 as shown for number 5 appears two times . I hope I could explain my problem clearly. Thanks for any help
8 commentaires
akshat gupta
le 26 Juin 2020
what do yo mean by "c1h1 and c1h1 should be similar as much as we can" ?
Rik
le 26 Juin 2020
Your explanation is a bit difficult to follow. Can you explain for your example step by step why the results are as you describe?
Hamdia Mansour
le 26 Juin 2020
Hamdia Mansour
le 26 Juin 2020
Image Analyst
le 26 Juin 2020
To try to bring some clarity to this...
amatrix =[5 5 0 0 0 0;6 1 0 0 0 0;2 2 2 2 2 2]
bmatrix =[5 5 0 0 0 0 0;5 1 5 0 0 0 0;2 2 2 2 4 6 6; 6 6 6 6 1 1 0]
%The expected solution is
C1h1=[5 5 ;6 1]
C1h2=[5 5 0 0 0 0;6 6 6 6 1 1]
C2h1 =[2 2 2 2 2 2]
C2h2=[2 2 2 2 4 6 6; 5 1 5 0 0 0 0]
amatrix =
5 5 0 0 0 0
6 1 0 0 0 0
2 2 2 2 2 2
bmatrix =
5 5 0 0 0 0 0
5 1 5 0 0 0 0
2 2 2 2 4 6 6
6 6 6 6 1 1 0
C1h1 =
5 5
6 1
C1h2 =
5 5 0 0 0 0
6 6 6 6 1 1
C2h1 =
2 2 2 2 2 2
C2h2 =
2 2 2 2 4 6 6
5 1 5 0 0 0 0
But other than that, I think you'll have to wait for Walter. He's the only one with the Mind Reading Toolbox. Why do you want to do this quirky thing anyway? What is the use case (context)???
Hamdia Mansour
le 26 Juin 2020
Hamdia Mansour
le 26 Juin 2020
Hamdia Mansour
le 26 Juin 2020
Réponses (1)
Hamdia Mansour
le 28 Juin 2020
0 votes
3 commentaires
Walter Roberson
le 28 Juin 2020
Your explanation of what should go into which matrix does not make any sense to me.
Hamdia Mansour
le 28 Juin 2020
Hamdia Mansour
le 28 Juin 2020
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!