How do you order the results of the combination?

1 visualización (últimos 30 días)
EUNHEI KIM
EUNHEI KIM el 25 de En. de 2020
Comentada: EUNHEI KIM el 26 de En. de 2020
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.

Respuesta aceptada

Akira Agata
Akira Agata el 25 de En. de 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'}

Más respuestas (0)

Categorías

Más información sobre Get Started with Aerospace Blockset en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by