フィルターのクリア

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 Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by