Binary string to character conversion
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello, If I have a string, S = 001000110111 Given:
a = 0
b = 10
c = 110
d = 111
I need to convert the string using that key.
So converted_S = aabaacd
How can I do this? Thanks.
댓글 수: 0
채택된 답변
Grzegorz Knor
2012년 3월 20일
S = '001000110111';
a = '0';
b = '10';
c = '110';
d = '111';
S = strrep(S,d,'d');
S = strrep(S,c,'c');
S = strrep(S,b,'b');
S = strrep(S,a,'a')
댓글 수: 5
Grzegorz Knor
2012년 3월 20일
regexp works correctly in this case :) strrep first looks for patterns, and then replace it.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!