how to reset the axes in this situation of my GUI?

3 views (last 30 days)
i tried everything i could find, but no clue how to do it !
function varargout = CST(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CST_OpeningFcn, ...
'gui_OutputFcn', @CST_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code
% --- Executes just before CST is made visible.
function CST_OpeningFcn(hObject, ~, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = CST_OutputFcn(~, ~, handles)
varargout{1} = handles.output;
function a_Callback(~, ~, ~)
function a_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function d_Callback(~, ~, ~)
function d_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function N_Callback(~, ~, ~)
function N_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function dz_Callback(~, ~, ~)
function dz_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function b_Callback(~, ~, ~)
function b_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function c_Callback(~, ~, ~)
function c_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function e_Callback(~, ~, ~)
function e_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function f_Callback(~, ~, ~)
function f_CreateFcn(hObject, ~, ~)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

Accepted Answer

Geoff Hayes
Geoff Hayes on 26 Aug 2016
oussama - you seem to have the code for your Clear pushbutton callback, but you have commented out and it is in the middle of another function. Move this code
%function clear_Callback(hObject, eventdata, handles)
%set(findobj(0,'style','edit'),'string','');
%set(handles.a,'string',num2str(0));
%set(handles.b,'string',num2str(0));
%set(handles.c,'string',num2str(0));
%set(handles.d,'string',num2str(0));
%set(handles.e,'string',num2str(0));
%set(handles.f,'string',num2str(0));
%set(handles.dz,'string',num2str(0));
%set(handles.N,'string',num2str(0));
%cla(handles.axes,'reset');
to follow all of the code for the ClassShape function and then uncomment the code. This should work but this callback doesn't seem to be assigned to your clear button (I'm not sure why). So open the GUI in GUIDE and open the Property Inspector for the clear button. For the Callback property, set this value to
@(hObject,eventdata)CST('clear_Callback',hObject,eventdata,guidata(hObject))
then close the inspector and save. (You may want to verify that this was updated by going back into the inspector to see what has been assigned to the Callback property.) Now when you launch your GUI, the clear_Callback function will fire when you press the clear button.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!