📄 dsulayout.m
字号:
function dsulayout
% 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 the GUI figure window
% H.plots Array of plot handles for figures opened with this gui.
% BOXPLOTS
% H.popbox Handle to the popupmenu specifying the type of boxplot
% {'Regular';'Notched';'Box-percentile';'Histplot'}
% H.dimbox Handle to the edit box specifying the dimensions to display boxplots
% HISTOGRAMS
% H.pophist Handle to the popupmenu specifying the bandwidth rule for the histograms
% {'Normal Rule';'Freedman-Diaconis';'Sturges'' Rule'}
% H.dimhist Handle to the edit box specifhing the dimensions to display histograms
% REMOVED THE FOLLOWING EDIT BOX - TOO HARD TO PROGRAM
% H.bandw Handle to the edit box specifying the normal bandwidth rule as default
% QQ PLOTS
% H.popqqt Handle to the popupmenu specifying the distribution for the qq plot
% {'Normal';'Exponential';'Gamma';'Chi-square';'Lognormal';'Uniform'}
% H.dimqq Handle to the edit box specifying the dimensions to display qq plots
ud = get(0,'userdata');
H.fig = figure('Tag','univgui',...
'position',[150 150 726 524],...
'resize','off',...
'toolbar','none',...
'menubar','none',...
'numbertitle','off',...
'name','Distribution Shapes - Univariate GUI',...
'CloseRequestFcn','univgui(''close'')');
if strcmp(version('-release'),'14')
set(0,'DefaultUicontrolFontname','Sans Serif');
end
% Keep track of GUI plots in this array. So, we can close when the gui is
% closed.
H.plots = [];
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',[21 306 680 140]);
uicontrol(H.fig, 'style','frame',...
'position',[21 160 680 140]);
uicontrol(H.fig, 'style','frame',...
'position',[21 15 680 140]);
%%%%%%% TEXT BOXES %%%%%%%%%%%%%%
% set up all of the text boxes
uicontrol(H.fig,'style','text',...
'position',[170 485 330 27],...
'fontweight','bold',...
'fontsize',14,...
'backgroundcolor',[.8 .8 .8],...
'string','Distribution Shapes - Univariate')
% Title boxes
uicontrol(H.fig,'style','text',...
'position',[40 420 70 17],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Boxplots')
uicontrol(H.fig,'style','text',...
'position',[40 270 70 17],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Histograms')
uicontrol(H.fig,'style','text',...
'position',[40 130 70 17],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Q-Q Plots')
% Instruction text boxes:
uicontrol(H.fig,'style','text',...
'position',[125 408 540 30],...
'horizontalalignment','left',...
'string','Produces side-by-side boxplots of the specified columns of the data matrix. See the individual functions in the EDA Toolbox for variable width boxplots and unequal sample sizes.')
uicontrol(H.fig,'style','text',...
'position',[124 260 540 30],...
'horizontalalignment','left',...
'string','Produces a probability density histogram (area integrates to one) for each of the specified columns of the data matrix.')
uicontrol(H.fig,'style','text',...
'position',[125 100 540 50],...
'horizontalalignment','left',...
'string','To get a q-q plot, we generate a random sample of size n from the specified distribution. A column of the data matrix and the generated sample are ordered and plotted as (x,y) pairs. If the points fall approximately on a straight line, then the distribution shapes match.')
uicontrol(H.fig,'style','text',...
'position',[150 450 450 35],...
'horizontalalignment','left',...
'backgroundcolor',[.8 .8 .8],...
'string','Works on single columns (variables or dimensions) of the data matrix. Use these capabilities to explore the distribution characteristics of your variables.')
% Steps - text in frame 1
uicontrol(H.fig,'style','text',...
'position',[40 365 150 30],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Select type of boxplot:')
uicontrol(H.fig,'style','text',...
'position',[203 365 312 30],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Enter dimensions to display (separated by commas) or enter ''all'':')
uicontrol(H.fig,'style','text',...
'position',[550 365 150 30],...
'fontsize',9,...
'horizontalalignment','left',...
'string','3. Push button to display:')
% Steps - text in frame 2
uicontrol(H.fig,'style','text',...
'position',[40 225 190 30],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Select bandwidth rule:')
uicontrol(H.fig,'style','text',...
'position',[203 225 312 30],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Enter dimensions to display (separated by commas) or enter ''all'':')
uicontrol(H.fig,'style','text',...
'position',[550 225 150 30],...
'fontsize',9,...
'horizontalalignment','left',...
'string','3. Push button to display:')
% Steps - text in frame 3
uicontrol(H.fig,'style','text',...
'position',[40 65 230 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Select type of distribution:')
uicontrol(H.fig,'style','text',...
'position',[203 65 312 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Enter dimensions to display (separated by commas) or enter ''all'':')
uicontrol(H.fig,'style','text',...
'position',[550 65 150 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','3. Push button to display:')
%%%%%%% BUTTONS %%%%%%%%%%%%%%%%%%%%
uicontrol(H.fig,'style','pushbutton',...
'position',[14 491 88 23],...
'string','LOAD DATA',...
'tooltipstring','This will bring up the Load Data GUI',...
'callback','loadgui')
uicontrol(H.fig,'style','pushbutton',...
'position',[14 463 88 23],...
'string','TRANSFORM',...
'tooltipstring','This will bring up the Transform Data GUI.',...
'callback','transformgui')
uicontrol(H.fig,'style','pushbutton',...
'position',[555 330 100 25],...
'string','DISPLAY PLOT',...
'tooltipstring','This will display the boxplots.',...
'callback','univgui(''dispbox'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[555 190 100 25],...
'string','DISPLAY PLOT',...
'tooltipstring','This will display the histograms.',...
'callback','univgui(''disphist'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[555 43 100 25],...
'string','DISPLAY PLOT',...
'tooltipstring','This will display the q-q plots.',...
'callback','univgui(''dispqq'')')
% Close button
uicontrol(H.fig,'style','pushbutton',...
'position',[620 485 66 25],...
'string','CLOSE',...
'callback','univgui(''close'')',...
'tooltipstring','Push this button to close the GUI window.')
%%%%%%% POPUPMENUS %%%%%%%%%%%%%%%%%%%%%%%
H.popbox = uicontrol('style','popupmenu',...
'String',{'Regular';'Notched';'Box-percentile';'Histplot'},...
'position',[42 330 100 22],...
'backgroundcolor','white');
H.pophist = uicontrol('style','popupmenu',...
'String',{'Normal Rule';'Freedman-Diaconis';'Sturges'' Rule'},...
'position',[42 190 100 22],...
'backgroundcolor','white');
H.popqqt = uicontrol('style','popupmenu',...
'String',{'Normal';'Exponential';'Gamma';'Chi-square';'Lognormal';'Uniform';'Poisson'},...
'position',[42 44 100 22],...
'backgroundcolor','white');
%%%%%% EDIT BOXES %%%%%%%%%%%%%%%%%%%%%%
H.dimbox = uicontrol('style','edit',...
'string','all',...
'position',[290 333 82 22],...
'backgroundcolor','white');
H.dimhist = uicontrol('style','edit',...
'string','all',...
'position',[290 190 82 22],...
'backgroundcolor','white');
H.dimqq = uicontrol('style','edit',...
'string','all',...
'position',[290 45 82 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 + -