Include a string variable for a plot title in function prompt

조회 수: 2 (최근 30일)
balsip
balsip 2017년 1월 16일
댓글: balsip 2017년 1월 16일
Hello,
I have a plot function that includes a title () call.
In the function's prompt, I would like to provide not only the X and Y variables, but string information that would get included in the title printed on the plot resulting from the running of the function.
I imagine the prompt would look something like this:
function(X1,Y1,'Sexy Plot Title');
But how would the first line of the function and the title() call within the function need to read to enable this?

채택된 답변

Image Analyst
Image Analyst 2017년 1월 16일
Define a function, either in the same m-file, or in a different m-file.
function MyPlottingFunction(X, Y, caption)
plot(X, Y, 'b*-');
title(caption, 'FontSize', 30);
To call from another different function
MyPlottingFunction(X1, Y1, 'Sexy Plot Title');
  댓글 수: 1
balsip
balsip 2017년 1월 16일
That did the trick! Thanks, IA.
(You're all over the place tonight!)

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

추가 답변 (0개)

카테고리

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