From logical to binary ?
조회 수: 24 (최근 30일)
이전 댓글 표시
So firstly i have convert a string into decimal then i do a xor to it so as the result i have a logical result stored in the variable k.
word = 'TEST';
binary = dec2bin(word,8);
bin=binary(:)-'0';
k = xor(bin, t4(1:length(bin)));
i tried to convert back using bin2dec function like :
w = xor(k, t4(1:length(bin)));
w=char(bin2dec(reshape(w,8,[]).')).';
But got an error say that the Input must be a string. i think it is because the input are logical value. Can someone correct me? or show me how to convert back from logical to binary ?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!