Splitting matrices into small matrices based on column values

7 vues (au cours des 30 derniers jours)
Yaser Khojah
Yaser Khojah le 28 Fév 2018
Commenté : Bob Thompson le 1 Mar 2018
I have two matrices, A and B where A is the name of each field and B is their corresponding productions as:
A = [3 2 1 10;
1 3 2 20;
2 3 1 30;
3 2 1 25;
1 3 2 10;
2 3 1 15]
and
B = [10 20 5 10;
4 6 20 20;
5 10 20 30;
20 10 30 25;
4 20 12 10;
10 30 20 15]
The last column of each matrix represents their profit and they are matching. For example, filed 3 runs at 10, field 2 at 20 and field 3 runs at 5 to make profit of 10. Now I want to create matrices which shows only the matching order of each fields such as x = [3 2 1 10; 3 2 1 25] and their corresponding productions as [10 20 5 10;20 10 30 25]. In my model A and B sizes are 200,000 rows and I need to see how the profit is changing for each fields order. So, the result will be
AA_fields = [3 2 1 10; 3 2 1 25]
AA_Rate = [10 20 5 10; 20 10 30 25]
This is for the case of (3 2 1) and the rest will follow the same way with different matrices.
  1 commentaire
Bob Thompson
Bob Thompson le 1 Mar 2018
You can try working with the unique() command. I personally haven't used it yet, so I don't know if it will find the different sets and mark the accordingly, or if it will simply find only values which appear once.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by