Please I have created a gui with two push buttons; one for showing uitable and the other for hiding the uitable. My Problem is that, the Hide push button does not set the uitable's visibility to off. The code I have is shown below. Any help why this is not working? Thank you.
function []=hide()
SCR = get(0,'Screensize'); % Get screensize.
S.fh = figure('color',[0.8 0.8 0.8],'numbertitle','off',...
'units','pixels',...
'position',[SCR(3)/2-500 ,300 , 650, 600],...
'name','myTable',...
'resize','on');
movegui(S.fh,'center');
S.pb(1)=uicontrol('style','push','units','pixels','position',...
[5 530 150 30],'string','Show Table','fontsize',12,...
'fontweight','bold');
S.pb(2)=uicontrol('style','push','units','pixels','position',...
[255 530 170 30],'string','Hide Table','fontsize',12,...
'fontweight','bold');
%Callbacks
set(S.pb(1),'callback',{@pb_call1,S});
set(S.pb(2),'callback',{@pb_call2,S});
%PushButtons Operation
function []=pb_call1(varargin)
S=varargin{3};
S.t=uitable('Parent',S.fh,'Data',magic(10));
end
end
function []=pb_call2(varargin)
S=varargin{3};
S.t=uitable('Parent',S.fh,'Data',magic(10));
set(S.t,'visible','off')
end