Is there any function which returns the content of a variable as string?
조회 수: 2 (최근 30일)
이전 댓글 표시
We have to know the data type when using `sprintf` and it can convert limited types to string.
disp(var) can show the content of a variable of any type but it doesn't return anything.
댓글 수: 0
채택된 답변
Walter Roberson
2016년 3월 15일
evalc(var)
or
evalc(disp(var))
The result will be a string that might well have newlines in it. Also note that if you have struct or cell array components, then strings or vectors that are more than a few characters might get summarized like '[1 x 17 double]'
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
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!