📄 transformlayout.m
字号:
function transformlayout
% This function will layout the gui controls. Eventually, this will be
% included in the complete function. Just have it now for simplicity.
% First get the user data from the root. See if anything is stored there.
% H.fig Handle to GUI figure window
% H.pop1 Handle to popupmenu to specify type of transform
% {'Center at mean';'Center at median';'Scale using sigma';'Scale using IQR';'Center/Scale-mean/sigma';'Center/Scale-median/IQR'},...
ud = get(0,'userdata');
H.fig = figure('Tag','transformgui',...
'position',[150 150 726 524],...
'resize','off',...
'toolbar','none',...
'menubar','none',...
'numbertitle','off',...
'name','Transform Data GUI',...
'CloseRequestFcn','transformgui(''close'')');
if strcmp(version('-release'),'14')
set(0,'DefaultUicontrolFontname','Sans Serif');
end
if ~isempty(ud)
% Then something is there already. Add necessary handles to the
% structure.
ud.guis = [ud.guis(:); H.fig];
else
% Set the usual stuff and save in root.
ud = userdata;
set(0,'userdata',ud)
end
%%%%%%% FRAMES %%%%%%%%%%%%%%%
% set up all of the frames first.
uicontrol(H.fig, 'style','frame',...
'position',[50 303 600 135]);
uicontrol(H.fig, 'style','frame',...
'position',[50 153 600 135]);
uicontrol(H.fig,'style','frame',...
'position',[50 53 600 89]);
%%%%%%% TEXT BOXES %%%%%%%%%%%%%%
% set up all of the text boxes
uicontrol(H.fig,'style','text',...
'position',[244 471 190 27],...
'fontweight','bold',...
'fontsize',14,...
'backgroundcolor',[.8 .8 .8],...
'string','Transform Data')
uicontrol(H.fig,'style','text',...
'position',[75 410 155 20],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Spherize the Data')
uicontrol(H.fig,'style','text',...
'position',[75 251 220 20],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Transform Rows or Columns')
uicontrol(H.fig,'style','text',...
'position',[75 115 170 20],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Restore Original Data')
uicontrol(H.fig,'style','text',...
'position',[75 360 360 36],...
'horizontalalignment','left',...
'string','This transforms observations such that they are centered at at the origin, and the covariance matrix is equal to the identity matrix.')
uicontrol(H.fig,'style','text',...
'position',[77 200 455 40],...
'horizontalalignment','left',...
'string','Use these buttons to apply a transform to rows (observations) or columns (variables) of the data matrix.')
uicontrol(H.fig,'style','text',...
'position',[77 320 220 20],...
'fontsize',9,...
'horizontalalignment','left',...
'string','Push button to sphere your data:')
uicontrol(H.fig,'style','text',...
'position',[80 175 133 20],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Choose transform:')
uicontrol(H.fig,'style','text',...
'position',[400 168 140 35],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Push button to apply transform to:')
uicontrol(H.fig,'style','text',...
'position',[77 80 340 20],...
'fontsize',9,...
'horizontalalignment','left',...
'string','Push button to restore original data for further exploring:');
%%%%%%% BUTTONS %%%%%%%%%%%%%%%%%%%%
uicontrol(H.fig,'style','pushbutton',...
'position',[320 320 66 25],...
'string','SPHERE',...
'tooltipstring','Your current data set will be sphered.',...
'callback','transformgui(''sphere'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[550 195 66 25],...
'string','ROWS',...
'tooltipstring','Your current data set will have the transform applied to the rows of the data matrix.',...
'callback','transformgui(''transrows'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[550 170 66 25],...
'string','COLUMNS',...
'tooltipstring','Your current data set will have the transform applied to the columns of the data matrix.',...
'callback','transformgui(''transcols'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[450 80 66 25],...
'string','RESTORE',...
'tooltipstring','The original data will be your current data set.',...
'callback','w = who;transformgui(''restore'',w)')
uicontrol(H.fig,'style','pushbutton',...
'position',[600 485 66 25],...
'string','CLOSE',...
'callback','transformgui(''close'')',...
'tooltipstring','Push this button to close the GUI window.')
%%%%%%% POPUPMENUS %%%%%%%%%%%%%%%%%%%%%%%
H.pop1 = uicontrol('style','popupmenu',...
'String',{'Center at mean';'Center at median';'Scale using sigma';'Scale using IQR';'Center/Scale-mean/sigma';'Center/Scale-median/IQR'},...
'position',[205 175 140 22],...
'backgroundcolor','white');
% Save Handles for THIS GUI in the UserData for this figure.
set(gcf,'userdata',H)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -