www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodel/buildmodels.m
function [mlist,ok] = buildmodels(m,nobs) %#ok<INUSD> %BUILDMODELS Show the Copy from Model Browser dialog % % MDEV = buildmodels( m,nobs ); % % Copyright 2006-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. mbh= MBrowser; p = get(mbh,'CurrentNode'); mdev= info(p); msg = 'Choose a model node with child nodes or a point-by-point model node.'; if nfactors(m)==1 msg = [msg, 'The model must have 1 input.']; else msg = sprintf('%s The model must have %d inputs.',msg,nfactors(m)); end helpStr = sprintf('Select the models you want to copy. %s',msg); dlg = mbcgui.container.Dialog('Name','Copy Models',... 'Size',[300 340],... 'InfoString',helpStr,... 'InfoHeight',40,... 'Buttons','OK_CANCEL',... 'Resize', 'off'); fh = dlg.Figure; proj = root(mdev); % treeview to select item h= treeview(info(proj),'create',[20 20 200 400],fh,cell(0,2)); % Select this mdev treeview(mdev,'select',h); mlist = {}; dlg.Content = h; closeMode = dlg.showDialog(); if strcmp(closeMode, 'OK') pCopy = treeview(info(proj),'current',h); mCopy = pCopy.model; if strcmp(pCopy.guid,'global') && ... nfactors(m) == nfactors(mCopy) mlist = pCopy.children(@model); if isempty(mlist) h = warndlg(msg,'Copy Models','modal'); waitfor(h); end elseif strcmp(pCopy.guid,'ptbypt') && ... nfactors(m) == nfactors(mCopy) % local multi models mlist = get(mCopy,'models'); else h = warndlg(msg,'Copy Models','modal'); waitfor(h); end end ok = ~isempty(mlist); if ok % reset all models mlist = cellfun(@reset,mlist,'UniformOutput',false); end delete(dlg);