fprintf help wont show full statement

조회 수: 5 (최근 30일)
Ben Newton
Ben Newton 2019년 10월 31일
댓글: Rena Berman 2019년 12월 12일
fprintf("afunc*bfunc gives us %d therefore is a root between 0 and 5 \n', rootproof")
%gives the output
afunc*bfunc gives us >>
where have i gone wrong?
  댓글 수: 5
Stephen23
Stephen23 2019년 11월 8일
Original question:
fprintf("afunc*bfunc gives us %d therefore is a root between 0 and 5 \n', rootproof")
%gives the output
afunc*bfunc gives us >>
where have i gone wrong?
Rena Berman
Rena Berman 2019년 12월 12일
(Answers Dev) Restored edit

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

답변 (1개)

Rik
Rik 2019년 10월 31일
Simply pasting what you posted into my copy of Matlab gives a hint about the cause:
I get a warning from m-lint (the orange squiggle) that states that "The format might not agree with the argument count".
The reason is that you made the entire input a string, instead of only the format specifier. Do not mix single and double quotes. Either of the versions below will work.
rootproof=3;
fprintf("afunc*bfunc gives us %d therefore is a root between 0 and 5 \n", rootproof)
fprintf('afunc*bfunc gives us %d therefore is a root between 0 and 5 \n', rootproof)
  댓글 수: 2
Steven Lord
Steven Lord 2019년 10월 31일
Good catch, I missed that mark after the word rootproof.
Rik
Rik 2019년 10월 31일
I just formatted the question, so now it is more obvious ;)

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

카테고리

Help CenterFile Exchange에서 Scripts에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by