read text and put it in the title

조회 수: 3 (최근 30일)
alpedhuez
alpedhuez 2020년 6월 8일
댓글: madhan ravi 2020년 6월 19일
I want to have a text as an input of a function test.m such that
function test(x,y,title_number, title_name)
plot(x,y)
end
Suppose I choose
test(x,y,1, temperature)
I want to have the title of the plot as
Figure 1. Temperature
Then I want to understand how to write title like
title(['Figure ',num2str(figurenumber),':]
Please advise.
  댓글 수: 4
Rik
Rik 2020년 6월 9일
doc figure
Then you can click on the link with 'figure properties'.
madhan ravi
madhan ravi 2020년 6월 19일
alpedhuez you have asked 220 questions in total and I'm really surprised that you are still asking the basic questions ?

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

답변 (1개)

Vishal Gaur
Vishal Gaur 2020년 6월 9일
편집: Vishal Gaur 2020년 6월 19일
You can add a title with variable in following way:
Suppose you want title like this: Figure 1: Sample Plot
figNo = 1;
figName = 'Sample Plot';
title(['Figure ' num2str(figNo) ': ' figName])
For more information, you can refer this documentation:

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by