a function that draws a plot and uses an input for the title of the plot

조회 수: 1 (최근 30일)
In my Livescript called test.mlx, I have variables
days
temperatures
I now want to write a function m file that outputs a plot with specification as
plot(days, temperatures)
legend('temperatures')
title('Figure 4. Temperatures')
Then, what I did is to write a function m file called plot1.m
function plot_test(series1, series2, figurenumber)
plot(series1, series2)
legend('series2')
end
Then how should one understand the title part?
  댓글 수: 3
alpedhuez
alpedhuez 2020년 5월 31일
Yes the question is how to put the file input into this text argument of a function title.
Mohammad junaid
Mohammad junaid 2020년 6월 1일
function plot_test(series1,series2,fignumber)
plot(series1,series2);
l_name = string(series2);
legend(l_name);
t_name=['figure',num2str(fignumber),'.temperatures'];
title(t_name);
end
i hope this wiil help..!

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

채택된 답변

KSSV
KSSV 2020년 5월 31일
figurenumber = 4 ;
title_name = ['Figure',num2str(figurenumber),'.Temperatures'] ;
title(title_name)

추가 답변 (0개)

카테고리

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