www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregstatsmodel/propPageModel.m

    function hGrid = propPageModel(mdl, hGroup,hParent)
%PROPPAGEMODEL property page for model
%    hGrid = propPageModel(mdl, hGroup,hParent)

%  Copyright 2009-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin<3 
    hParent = hGroup.Parent;
end
% Display model origination info, plus model description
INFO = getinfo(mdl);
projfile = 'Unknown';
mdlpath = 'Unknown';
loadEn = 'off';
if ~isempty(INFO);
    if isfield(INFO, 'Parent') && exist(INFO.Parent, 'file')
        [~,f,~]= fileparts(INFO.Parent);
        projfile = f;
        loadEn = 'on';
    end
    if isfield(INFO, 'path')
        mdlpath = INFO.path;
    end
end
hFile = i_maketextcontrol(hParent, 'Model project file:', projfile, 90);
hModelPath = i_maketextcontrol(hParent, 'Model path:', mdlpath, 90);
hModelLoad = uicontrol('Parent', hParent, ...
    'Style', 'pushbutton', ...
    'Enable', loadEn, ...
    'String', 'Load Model', ...
    'Callback', {@i_loadmodel, hGroup});


hModelDispLabel = uicontrol('Parent', hParent, ...
    'Style', 'text', ...
    'Enable', 'inactive', ...
    'HorizontalAlignment', 'left', ...
    'String', 'Model definition:');
SC = xregGui.SystemColorsDbl;
hPanel = mbcgui.container.layoutpanel('Parent', hParent, ...
    'BorderType', 'beveledin');
hModelDisp = xregMdlGui.modelpane('parent', hPanel, ...
    'backgroundcolor', SC.CTRL_BACK, ...
    'model', model(mdl));
set(hPanel, 'LayoutComponent', hModelDisp);

hGrid = xreggridbaglayout(hParent, ...
    'dimension', [7 2], ...
    'rowsizes', [15 10 15 10 15 2 -1], ...
    'colsizes', [-1 75], ...
    'mergeblock', {[1 2], [2 2]}, ...
    'mergeblock', {[3 3], [1 2]}, ...
    'mergeblock', {[5 5], [1 2]}, ...
    'mergeblock', {[7 7], [1 2]}, ...
    'elements', {hFile, [], hModelPath, [], hModelDispLabel, [], hPanel, hModelLoad});

function h = i_maketextcontrol(hParent, Label, Text, LabelSize)
h = xregGui.labelcontrol('parent', hParent, ...
    'LabelSizeMode', 'absolute', ...
    'LabelSize', LabelSize, ...
    'ControlSizeMode', 'relative', ...
    'ControlSize', 1, ...
    'String', Label, ...
    'Control', mbcgui.widget.Label('Parent', hParent, ...
    'HorizontalAlignment', 'left', ...
    'String', Text));


function i_loadmodel(~, ~, hGroup)
loadmodel(get(hGroup.getObject, 'model'));