How to have this title graph?

조회 수: 1 (최근 30일)
Elia Paini
Elia Paini 2022년 3월 22일
편집: Star Strider 2022년 3월 23일
Hi, I have to plot a graph displaying in the title two parameters each iteration, "cycle" and "minute", with the values after "=".
I can do it only with 1 variable, but if I try in this way:
....
title([' cycle = , minute = ', num2str(cycle), num2str(minute)])
It doesn't show them correctly.
What should I can do? Thank you!

답변 (1개)

Star Strider
Star Strider 2022년 3월 22일
편집: Star Strider 2022년 3월 23일
Use sprintf instead —
cycle = 42;
minute = 24;
title(sprintf('cycle = %.2f, minute = %.2f', cycle, minute))
Change the format string to get the result you want.
EDIT — (23 Mar 2022 at 4:53)
Corrected typographical error.
.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by