필터 지우기
필터 지우기

two lines title with variable

조회 수: 22 (최근 30일)
Abdulaziz
Abdulaziz 2013년 9월 4일
댓글: Sreepada Ravikumar 2014년 6월 24일
Hi all,
I know how to include variables in title, but is there any way to include variable in title of two lines. I tried to use ({[' ; ']}) with int2str( variable) but it dose not work.
I appreciate your help.

채택된 답변

the cyclist
the cyclist 2013년 9월 4일
편집: the cyclist 2013년 9월 4일
Here's one way:
m = 1;
n = 2;
figure;
plot(1:10)
title({['Line ',num2str(m),' here'];['Line ',num2str(n),' here']})
  댓글 수: 2
Abdulaziz
Abdulaziz 2013년 9월 5일
Thank you it works I really appreciate
Sreepada Ravikumar
Sreepada Ravikumar 2014년 6월 24일
Thank U. It worked fine.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2013년 9월 5일
You can create a text string with sprintf(), then use title() to display it:
caption = sprintf('This image is %s\nIt has %d rows and %d columns',...
filename, rows, columns);
title(caption, 'FontSize', 30);
The text string can have the regular format specifiers like you're very much used to if you've done any programming before: %s, %.3f, %d, etc. and you can use \n if you want to go to a new line.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by