Splitting matrices into small matrices based on column values

1 回表示 (過去 30 日間)
Yaser Khojah
Yaser Khojah 2018 年 2 月 28 日
コメント済み: Bob Thompson 2018 年 3 月 1 日
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 Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by