How do you order the results of the combination?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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'}
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Aerospace Blockset 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!