필터 지우기
필터 지우기

Assigning plot to an existing axes Matlab GUI

조회 수: 55 (최근 30일)
Franta Cymorek
Franta Cymorek 2017년 2월 12일
편집: Franta Cymorek 2017년 2월 13일
Hi, I have a GUI in Matlab and several functions in it. One function is for plotting a figure, I need to assign it to an existing axes in GUI. I have tried several options, nothing has worked out yet.
Code below is the current option I had tried before I asked here.
set('CurrentAxes','axes11')
plot(VyQRS(:,2));
grid on
The plot of VyQRS I need to assign to axes11. Could you please give me any hint?

채택된 답변

Image Analyst
Image Analyst 2017년 2월 12일
Try this:
axes(handles.axes11); % Switch current axes to axes11.
plot(VyQRS(:,2)); % Will plot into axes11.
grid on
  댓글 수: 8
Image Analyst
Image Analyst 2017년 2월 12일
To fix you need to pass handles into your custom pushbutton function:
function MyCustomPushButtonFunction(handles)
VyQRS=[[0:length(VyQRS)-1]' VyQRS];
axes(handles.axes11);
plot(VyQRS(:,2));
grid on
Vy_QRS=ginput;
y_pointsQRS=VyQRS(Vy_QRS(1,1)<=VyQRS(:,1) & Vy_QRS(2,1)>=VyQRS(:,1),:);
if size(y_pointsQRS,1)<m
m=2;
end
Then, in a callback function, which automatically has access to handles, or some other function that has access to handles, you must call your custom function and pass handles to it:
MyCustomPushButtonFunction(handles); % Call your custom function.
Franta Cymorek
Franta Cymorek 2017년 2월 13일
편집: Franta Cymorek 2017년 2월 13일
Still does not work. Did exactly what You told me to do.
Error:
Undefined function or variable 'VxQRS'.
Error in VKG_Zobrazovac>pushbutton4_Callback (line 156)
x_pointsQRS = MyCustomPushButtonFunctionQRS10(VxQRS);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in VKG_Zobrazovac (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)VKG_Zobrazovac('pushbutton4_Callback',hObject,event data,guidata(hObject))
Error while evaluating UIControl Callback

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by