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

    function ok = canExportToSimulink(m)
%CANEXPORTTOSIMULINK return flag to say when Simulink export is supported
%
%  OK = CANEXPORTTOSIMULINK(M)
%
%  Returns true when model m supports export to Simulink 
%
%
%  See also MODELBUILD, MV2SL.

%  Copyright 2012 The MathWorks, Inc. and Ford Global Technologies, Inc.

% check whether each of the component models supports export to Simulink

% global models
global_models=globalmodels(m);
ok = false(1,length(global_models));
for i=1:length(global_models)
   ok(i) = canExportToSimulink(global_models{i});
end

% datum model
DtmMod=datummodel(m);
if ~isnumeric(DtmMod)
    ok(end+1) = canExportToSimulink(DtmMod);
end

% local model
local_model=get(m,'local');
ok(end+1) = canExportToSimulink(local_model);

% return ok if no problems
ok = all(ok);