fprint problem in matlab
조회 수: 4 (최근 30일)
이전 댓글 표시
why the outstr value is 24 here ?
댓글 수: 0
답변 (1개)
Star Strider
2020년 6월 2일
The fprintf fuction returns the number of bytes ouitput to the file.
댓글 수: 2
Star Strider
2020년 6월 2일
In the code in your image of it (not the actual code, that I had to type in manually), the value is in ‘outstr’. It writes 24 bytes to the file, and the full string to your Command Window (the default output), returning 24 in ‘outstr’.
If you want it to return the actual string to your workspace, use:
outstr = sprintf('The answer is %s', data1);
That works. (I tested it.)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!