How do you order the results of the combination?

2 ビュー (過去 30 日間)
EUNHEI KIM
EUNHEI KIM 2020 年 1 月 25 日
コメント済み: EUNHEI KIM 2020 年 1 月 26 日
I changed 14 letters to cell type first.
Then, using a combination (C) of 14 cell types, we got 364 results. (14C3)
EX> abc
abd
abe....
I want to match each of the 364 results and each of the 364 date
(01-01 abc
01-02 abd
01-03 abe.....)
So I thought I had to order 364 results first.
But I don't know what to do.
And maybe my way was wrong.
Give them a hand.
I am a foreigner and I have no friend who uses Matlab among my friends.

採用された回答

Akira Agata
Akira Agata 2020 年 1 月 25 日
Like this?
% Create 1-by-14 cell array {'a','b', ..., 'n'}
str = 'a':'n';
c = split(str,'')';
c([1 end]) = [];
% Create all the 3-character selection
cmb = nchoosek(c,3);
cmb = strcat(cmb(:,1),cmb(:,2),cmb(:,3));
% Create 364 date and 3-character lookup table
date = datetime(2019,1,1:364)';
T = table(date,cmb,'VariableNames',{'date','char'});
The result is as follows:
>> T
T =
364×2 table
date char
__________ _______
2019/01/01 {'abc'}
2019/01/02 {'abd'}
2019/01/03 {'abe'}
....
2019/12/30 {'lmn'}
  1 件のコメント
EUNHEI KIM
EUNHEI KIM 2020 年 1 月 26 日
Thank you very much ^^

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by