Generate all possible subset from a character array in MATLAB
古いコメントを表示
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 件のコメント
madhan ravi
2019 年 3 月 30 日
編集済み: madhan ravi
2019 年 3 月 30 日
But you have only 19 in the output?
Sangeetha R
2019 年 3 月 30 日
Walter Roberson
2019 年 3 月 30 日
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
2019 年 3 月 30 日
回答 (2 件)
Sangeetha R
2019 年 3 月 30 日
編集済み: Sangeetha R
2019 年 3 月 30 日
0 投票
Walter Roberson
2019 年 3 月 30 日
Consider
[S(1:end-2);
S(2:end-1);
S(3:end)].'
Now unique rows
カテゴリ
ヘルプ センター および File Exchange で Time-Frequency Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!