double2str and bin2str
조회 수: 29 (최근 30일)
이전 댓글 표시
Is there any valid commands in matlab like double2str and bin2str for data type conversion and storage?
댓글 수: 0
답변 (2개)
Awais Saeed
2021년 11월 14일
Doing
help bin2str
% and
help double2str
did not show any results from which I assume there are no such functions. Use num2str() or sprintf instead
binary = randi([0 1],1,10);
binaryStr = sprintf('%d', binary)
binaryStr2 = num2str(binary)
class(binaryStr)
class(binaryStr2)
댓글 수: 1
Awais Saeed
2021년 11월 14일
if you strickly want a string then
binary = randi([0 1],1,10);
Str = sprintf("The binary string is: %s", num2str(binary))
class(Str)
참고 항목
카테고리
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!