フィルターのクリア

Statistical method to arrange a set of variables in subsets

3 ビュー (過去 30 日間)
Nourhan Elsayed
Nourhan Elsayed 2020 年 10 月 13 日
コメント済み: Ameer Hamza 2020 年 10 月 14 日
dear all
i have a general mathematical question
i have an array of different numbers. size of the array is 16 x 6. i want to form a subset of a vector of size 1 x6 . each element of the vector is selected from the column that have the same index as this element .
example:
master Array is =
a1 b1 c1 d1 e1 f1
a2 b2 c2 d2 e2 f2
a3 b3 c3 d3 e3 f3
.
.
.
a16 b16 c16 d16 e16 f16
subset = a1 b2 c4 d3 e3 f13
all subsets must be on the order of a'b'c'd'e'f
what is the method that can form all possible subsets combined of the given master array. and what are the statistical therories that are applied to this sience of data sorting
  3 件のコメント
Nourhan Elsayed
Nourhan Elsayed 2020 年 10 月 13 日
yes, but combinations that are not in the order ''a,b,c,d,e,f,g ''are to be eleminated
Ameer Hamza
Ameer Hamza 2020 年 10 月 13 日
16^6 combinations exist after excluding non-''a,b,c,d,e,f,g'' combinations.

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

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 13 日
This code shows how to generate all combinations as you mentioned in your question
M = rand(16, 6); % example
rows = cell(1,6);
[rows{:}] = ndgrid(1:16);
rows = cellfun(@(x) {x(:)}, rows);
rows = [rows{:}];
cols = repmat(1:6, size(rows,1), 1);
idx = sub2ind(size(M), rows, cols);
M_out = M(idx);
  2 件のコメント
Nourhan Elsayed
Nourhan Elsayed 2020 年 10 月 14 日
thank you Ameer
it works
Ameer Hamza
Ameer Hamza 2020 年 10 月 14 日
I am glad to be of help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by