How to group numeric variables in to single index

1 回表示 (過去 30 日間)
Kanakaiah Jakkula
Kanakaiah Jakkula 2016 年 12 月 23 日
コメント済み: Walter Roberson 2016 年 12 月 26 日
Hi,
I have below table contains three variables, each row represents a single observation, and I want to group them into single index. Kindly some one help how to group them in to single index.
4.82 0.3 10056
5.23 0.9 1235
4.98 0.85 125
9.65 0.46 4568
11.23 1.2 45689
5.98 0.78 46985
4.23 0.65 41256
4.32 1.1 2356
5.3 1.2 1815
1.25 3.1 1230
6.98 5.1 252
10.23 2.3 1236
2.6 0.59 142
Many thanks in advance,
  2 件のコメント
Walter Roberson
Walter Roberson 2016 年 12 月 23 日
What should the grouping be? All of the values appear to be unique.
Kanakaiah Jakkula
Kanakaiah Jakkula 2016 年 12 月 23 日
Yes, all 4 variables should be combined to see as a single index. So, each row represent a single value.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2016 年 12 月 23 日
編集済み: Walter Roberson 2016 年 12 月 23 日
A = [4.82 0.3 10056
5.23 0.9 1235
4.98 0.85 125
9.65 0.46 4568
11.23 1.2 45689
5.98 0.78 46985
4.23 0.65 41256
4.32 1.1 2356
5.3 1.2 1815
1.25 3.1 1230
6.98 5.1 252
10.23 2.3 1236
2.6 0.59 142];
A_grouped = mat2cell(A, ones(1, size(A,1)), 3);
Now A_grouped{1} will be the first row, A_grouped{2} will be the second row, and so on -- the rows would be grouped in a single index.
If this is not what you want, then you will need to show us a sample output.
  6 件のコメント
Kanakaiah Jakkula
Kanakaiah Jakkula 2016 年 12 月 26 日
Yes Sir, dimention reduction in directly, but just give to give more weightage to the one which have highvariance.
Walter Roberson
Walter Roberson 2016 年 12 月 26 日
V = var(A(:, 1:2));
output = A(:, 3) ./ sum( bsxfun( @mult, V, A(:,1:2)), 2);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by