Splitting matrices into small matrices based on column values

2 次查看(过去 30 天)
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 个评论
Bob Thompson
Bob Thompson 2018-3-1
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by