Generate all possible subset from a character array in MATLAB
Ältere Kommentare anzeigen
I need to generate all possible subset from a character array with reduced execution time. Actual input is of length '500' characters and maximum length of subset is limited to 20 characters.
For example:
input='ABCA';
output ='A', 'B', 'C', 'AB', 'BC', 'CA', 'ABC', 'BCA', 'ABCA'
4 Kommentare
madhan ravi
am 30 Mär. 2019
Bearbeitet: madhan ravi
am 30 Mär. 2019
But you have only 19 in the output?
Sangeetha R
am 30 Mär. 2019
Walter Roberson
am 30 Mär. 2019
Could you confirm that length(unique(input)) is 500? For example 500 Chinese ideographs? As opposed to length(input) being 500 but the number of unique being much smaller?
Sangeetha R
am 30 Mär. 2019
Antworten (2)
Sangeetha R
am 30 Mär. 2019
Bearbeitet: Sangeetha R
am 30 Mär. 2019
0 Stimmen
Walter Roberson
am 30 Mär. 2019
Consider
[S(1:end-2);
S(2:end-1);
S(3:end)].'
Now unique rows
Kategorien
Mehr zu Time-Frequency Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!