How do you order the results of the combination?

1 view (last 30 days)
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.

Accepted Answer

Akira Agata
Akira Agata on 25 Jan 2020
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'}

More Answers (0)

Categories

Find more on Get Started with Aerospace Blockset in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!