fprintf( '%7sVIII\n', 'Henry' )
fprintf( '%1sVIII\n', 'Henry' )
I can't understand the difference between the two. They have the same output. How does the field size value effect the fprintf?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 14일

0 개 추천

Write this, you will understand
fprintf( '%50sVIII\n', 'Henry' )

댓글 수: 3

Hussain Hayat
Hussain Hayat 2015년 7월 15일
So does this sort of create an empty string before Henry. Why does it add VIII later then?
Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 15일
편집: Azzi Abdelmalek 2015년 7월 15일
%50s, will be replaced by a string 'henry' with length equal to 50 characters, that's why you 45 blanks and the five character of 'Henry'.
VIII? because you add it!
Hussain Hayat
Hussain Hayat 2015년 7월 15일
I cant figure out how this function works completely, I did check MATLAB help, hoping that this example can help clear it up.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

제품

태그

질문:

2015년 7월 14일

댓글:

2015년 7월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by