Hi all,
I've created a GUI where it takes user input and calualtes and plots the results. All the calculation happens in a function called picrotor. This function takes input model and generates a plot.
I've created a push button which has a call back function defined as follows.
function [] = tb1_Callback(varargin)axes(handles.haxes)picrotor(model);end
Now I want this graph to be plotted in the GUI where I defined it by its handle.
handles.haxes = axes('Units','Normalized','Position',[.05,.1,0.90,0.38],... 'Parent',handles.f,'HandleVisibility','callback');
When I try to excecute the above GUI I get an error.
Reference to non-existent field 'haxes'.Error in sample_gui/tb1_Callback (line 396)axes(handles.haxes)Error while evaluating UIControl Callback
Can someone help to fix this error. thanks in adance for your hints and suggestions. I just wanted to put the call the function and display the graph in GUI
My complete Code is as follows.
handles.f = figure('visible','off',... 'Units','Normalized','Position',[25 25 1300 725],... 'numbertitle','off','Name','Simple GUI);handles.m = uimenu(handles.f,'Label','File');aboutm = uimenu(handles.m,'Label','About','callback',@about);docm = uimenu(handles.m,'Label','Documentation','callback',@documentation);% loadm = uimenu(m,'Label','Load Data','callback','load');
exitm = uimenu(handles.m,'Label','Exit','callback',@exit); handles.tb1 = uicontrol(handles.f,'Style','pushbutton',... 'String','Prepare_geom',... 'Value',0,'Units','Normalized','Position',[0.45 .90 0.07,0.04],... 'Callback',{@tb1_Callback,handles});handles.haxes = axes('Units','Normalized','Position',[.05,.1,0.90,0.38],... 'Parent',handles.f,'HandleVisibility','callback'); % Move the GUI to the center of the screen.
movegui(handles.f,'center') % Make the GUI visible.
handles.f.Visible = 'on';%%call back function for Push button Prepar_Geom
function [] = tb1_Callback(varargin)axes(handles.haxes)picrotor(model)end
Best Answer