how should I output this sentence in single quote instead of double quote? Because change the double quote to single quote directly is not work

 채택된 답변

Brent Kostich
Brent Kostich 2020년 5월 28일

0 개 추천

You need to use brackets when creating a multi-part sentence like that, which is equal to horzcat. Also, you need to use character segments, not strings.
pi = ['The approximation on ', num2str(n), ' terms is ', num2str(round(pi*4, 4))];

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2020년 5월 28일

댓글:

2020년 5월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by