A function that outputs multiple plots? Part 2

In a previous question, one learned a function without output and output plots.
I now want to write a function that output some numbers and multiple plots. I have tried
figure(1);plot(x,y)
but did not work. What can be done?

답변 (1개)

Adam Danz
Adam Danz 2020년 8월 13일
편집: Adam Danz 2020년 8월 13일

0 개 추천

If you want to set the figure number,
h = figure();
% or
h = figure(5);
plotoutput(__,h) % fill in your other inputs
function plotoutput(__,figureHandle) % fill in your other inputs
% Test input
assert(isscalar(figureHandle) && isa(figureHandle,'matlab.ui.Figure'), ...
'figureHandle must be an existing figure handle.')
ax = axes(figureHandle);
plot(ax, ___)
end
--or--
n = 5;
function plotoutput(__, figureNumber)
% Test input
assert(isscalar(figureNumber) && mod(figureNumber,1)==0 && ...
figureNumber>0 && figureNumber < 2147483646, ...
'figureNumber must be a scalar integer from 1 to 2147483646')
h = figure(figureNumber);
ax = axes(h);
plot(ax, ___)
end

댓글 수: 3

alpedhuez
alpedhuez 2020년 8월 13일
I will provide a more detailed desciption of the problem.
Adam Danz
Adam Danz 2020년 8월 17일
Has your problem been solved?
alpedhuez
alpedhuez 2020년 8월 17일
Have been working on it.

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

카테고리

도움말 센터File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

질문:

2020년 8월 13일

댓글:

2020년 8월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by