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!