GUI handles problem
이전 댓글 표시
I have a GUI created in Guide where I create for axes (axes 1..axes4).
I want to plot data on these axes from another function defined in a seperate .m file. I thought I only hat to include "handles" as an argument to pass. In my seperate function where I want to plot to these axes, I use:
axes(handles.axes1)
plot(X,Y)
But I get an error
??? Error using ==> axes
Invalid object handle
Any suggestions to what I am doing wrong Thanks. Jason
채택된 답변
추가 답변 (1개)
Matt Tearle
2011년 2월 22일
0 개 추천
It sounds like you're trying to refer to a local variable in a separate function. The GUI function created by GUIDE contains the structure variable handles, with a field called axis1. You need to pass that variable to your plotting function when you call it, but you have to do so from within the main GUI function, otherwise it won't recognize the variable. How is your plotting function being invoked? The typical way in a GUI is that some interaction with the GUI invokes a callback. GUIDE callbacks take three arguments by default, the second being the handles structure.
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!