reset button gui matlab

19 views (last 30 days)
cyrine tijani
cyrine tijani on 11 Apr 2021
Commented: Walter Roberson on 14 Apr 2021
hi i'm using gui matlab and i want to put a reset button i used this instruction (cla(handles.axes1,'reset');) it worked but the axes became visible instead of invisible how can i fix that please any help ?

Answers (1)

Walter Roberson
Walter Roberson on 11 Apr 2021
cla RESET deletes all objects (including ones with hidden handles)
and also resets all axes properties, except Position and Units, to
their default values.
The default property of 'visible' is 'on' and the default property of 'box' is 'on', so when you use 'reset' then you are asking for those properties to be turned on.
You could try immediately turning those properties off again, but you should consider the possibility that 'reset' is not the right approach for you.
  7 Comments
Walter Roberson
Walter Roberson on 14 Apr 2021
%setup -- only needs to be done with respect to one axes, not all of them
ax = handles.axes1(1);
ax.Visible = 'off'; ax.Box = 'off';
props_to_ignore = {'BeingDeleted', 'Legend', 'Parent', 'Position', 'SubTitle', 'Title', 'Type', 'XAxis', 'YAxis', 'ZAxis'};
handles.ax_setable_properties = setdiff( fieldnames(set(ax)), ax_props_to_ignore);
handles.ax_master_props = get(ax, ax_setable_properties);
guidata(ax, handles);

Sign in to comment.

Categories

Find more on Visual Exploration in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!