function mainwin(labelList,nameList); %MAINWIN An Expo gateway routine for playing command line demos. % Ned Gulley, 6-21-93 % Copyright (c) 1984-1993 by The MathWorks, Inc. oldFigNumber=watchon; % Now initialize the whole figure... figNumber=figure( ... 'Name','Command Line Demos', ... 'NextPlot','New', ... 'NumberTitle','off', ... 'Position',[0 0 360 430]); axes('Visible','off', ... 'NextPlot','new') %==================================== % Information for all buttons labelColor=[0.8 0.8 0.8]; yInitPos=0.90; top=0.95; bottom=0.05; left=0.65; btnWid=0.3; btnHt=0.10; % Spacing between the button and the next command's label spacing=0.04; %==================================== % The CONSOLE frame frmBorder=0.02; yPos=0.05-frmBorder; frmPos=[left-frmBorder yPos btnWid+2*frmBorder 0.9+2*frmBorder]; h=uicontrol( ... 'Style','frame', ... 'Units','normalized', ... 'Position',frmPos, ... 'BackgroundColor',[0.5 0.5 0.5]); %==================================== % The CLOSE BLOCK DIAGRAM button labelStr='Close BDs'; callbackStr='bdclose'; infoHndl=uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left bottom+btnHt+spacing btnWid btnHt], ... 'String',labelStr, ... 'Callback',callbackStr); %==================================== % The CLOSE button labelStr='Close'; callbackStr='close(gcf)'; closeHndl=uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left bottom btnWid btnHt], ... 'String',labelStr, ... 'Callback',callbackStr); %==================================== % Information for demo buttons labelColor=[0.8 0.8 0.8]; %btnWid=0.32; btnWid=0.55; btnHt=0.05; top=0.95; bottom=0.35; right=0.75; leftCol1=0.05; leftCol2=right-btnWid; % Spacing between the buttons spacing=0.01; %spacing=(top-bottom-4*btnHt)/3; numButtons=size(labelList,1); col1Count=numButtons; %col1Count=fix(numButtons/2)+rem(numButtons,2); %col2Count=fix(numButtons/2); for count=1:col1Count, btnNumber=count; yPos=top-(btnNumber-1)*(btnHt+spacing); labelStr=deblank(labelList(count,:)); callbackStr='set(gco,''Back'',[0.5 0.5 0.5]); eval(get(gco,''UserData''));'; cmdStr=nameList(count,:); % Generic button information btnPos=[leftCol1 yPos-btnHt btnWid btnHt]; startHndl=uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',btnPos, ... 'String',labelStr, ... 'UserData',cmdStr, ... 'Interruptible','yes', ... 'Callback',callbackStr); end; watchoff(oldFigNumber);