How to write a function that returns a graph?
이전 댓글 표시
If I write a function like
function A = myplot(x,y)
A = plot(x,y);
set(A,etc....)
end
When I call this function, a lot of numbers instead of a plot are shown. If modify the code as follows,
function A = myplot(x,y)
plot(x,y)
end
then an error occurs as output argument "A" is not assigned during the call to the function.
How may I correct this?
채택된 답변
추가 답변 (2개)
Wayne King
2014년 2월 20일
You can simply not have an output argument
function myplot(x,y)
plot(x,y)
end
That's one way
Walter Roberson
2014년 2월 21일
2 개 추천
Remember, the return value from a plot() call is a handle graphics handle (or vector of them.) The actual plot resides in graphics memory.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!