Using fprintf to display multiple strings

조회 수: 22 (최근 30일)
Ananyapam De
Ananyapam De 2020년 7월 27일
편집: Stephen23 2020년 7월 27일
This piece of code
fprintf('%s + %s',char(955))
should give me λ+λ but it only gives λ +
How should I solve this?

답변 (2개)

KSSV
KSSV 2020년 7월 27일
fprintf('%s + %s',char(955),char(955))

Stephen23
Stephen23 2020년 7월 27일
편집: Stephen23 2020년 7월 27일
Very simply add an identifier to the format specifier:
fprintf('%1$s + %1$s',char(955))
% ^^ ^^ input identifiers
The identifier tells MATLAB which input to use. See:

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by