www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevtestplan/guiMultiModel.m
function [CreateItems,ok]=guiMultiModel(TP) %GUIMULTIMODEL dialog for exporting multimodels % % [CreateItems,ok]=guiMultiModel(TP) % Copyright 2007-2015 The MathWorks, Inc. dlg = mbcgui.container.Dialog('Name','Export Point-by-Point Models',... 'Size',[400 300],... 'Buttons','OK_CANCEL',... 'Resize','off'); figh = dlg.Figure; [lyt,udh] = iCreateLayout(figh, address(TP)); dlg.Content = lyt; set(lyt, 'packstatus', 'on', 'visible', 'on'); CreateItems.TradeOff = false; CreateItems.Dataset = false; CreateItems.Optim = false; CreateItems.Objective = 1; CreateItems.Objective = 'Minimize'; closeAction=dlg.showDialog(); if strcmp(closeAction, 'OK') ud = get(udh,'UserData'); if get(cgbrowser,'GUIExists') CreateItems.Optim = get(ud.optim,'Value'); CreateItems.TradeOff = get(ud.tradeoff,'Value'); CreateItems.Dataset = get(ud.dataset,'Value'); CreateItems.Objective = get(ud.objective,'Value'); val = get(ud.objectivetype,'Value'); str = get(ud.objectivetype,'String'); CreateItems.ObjectiveType = str{val}; end ok = 1; else ok = 0; end delete(dlg); function [lyt,udh] = iCreateLayout(figh,pTP) T = info(pTP); % list of response models ud.models = mbcwidgets.Table1D( 'list',... 'parent', figh,... 'SelectionMode', 'None'); ud.models.Peer.setColumnData( {'Point-by-point models'} ); ud.models.Peer.setColumnWidths( 360 ); Icons(1:pTP.numChildren) = {cgrespath('modelSwitch.bmp')}; ud.models.Peer.setData( ... pTP.children(@varname)'); ud.models.Peer.setIconData( Icons, 0); % display of boundary model c = BoundaryModel(T,0); if ~isempty(c) Name = getBestConstraintNames( T.ConstraintData.info ); bdry = sprintf('Boundary model: %s',Name); else bdry = sprintf('Boundary model: Local/Point-by-point range (created)'); end hBdry = uicontrol('Parent',figh,... 'Style','text',... 'HorizontalAlignment','left',... 'Visible','off',... 'String',bdry); txt = uicontrol('Parent',figh,... 'Style','text',... 'HorizontalAlignment','left',... 'Visible','off',... 'String','Create CAGE items:'); udh = txt; ud.tradeoff= uicontrol('Parent',figh,... 'Style','checkbox',... 'Position',[0 0 200 15],... 'Value',0,... 'Visible','off',... 'String','Point-by-point model tradeoff'); ud.dataset= uicontrol('Parent',figh,... 'Style','checkbox',... 'Value',0,... 'Visible','off',... 'String','Dataset for model operating points'); ud.optim= uicontrol('Parent',figh,... 'Style','checkbox',... 'Position',[0 0 100 20],... 'Value',1,... 'Visible','off',... 'Callback',{@iOptim,udh},... 'String','Optimization'); ud.objective = uicontrol('Parent',figh,... 'Style','popup',... 'Position',[0 0 120 15],... 'BackgroundColor','w',... 'Value',1,... 'Visible','off',... 'String',pTP.children(@varname)); ud.objectivetype = uicontrol('Parent',figh,... 'Style','popup',... 'Position',[0 0 80 15],... 'BackgroundColor','w',... 'Value',1,... 'Visible','off',... 'String',{'Minimize','Maximize'}); opt=xregflowlayout(figh,'packstatus','off',... 'orientation','left/top',... 'elements',{ud.optim,ud.objectivetype,ud.objective }); lyt = xreggridbaglayout(figh, ... 'packstatus', 'off', ... 'dimension', [8 1], ... 'rowsizes', [-1 10 40,10 15 20 20 20], ... 'elements', {ud.models,[],hBdry,[],txt ud.dataset,ud.tradeoff,opt}); set(udh,'UserData',ud) function iOptim(h,evt,udh) ud = get(udh,'UserData'); if get(h,'Value') set(ud.objective,'Enable','on'); set(ud.objectivetype,'Enable','on'); else set(ud.objective,'Enable','off'); set(ud.objectivetype,'Enable','off'); end