www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevproject/createTestplanFromTemplate.m
function T = createTestplanFromTemplate(MP,TemplateName,NewName) %CREATETESTPLANFROMTEMPLATE % % pTP= createTestplanFromTemplate(MP,templateName,NewName) % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. [p,f,e] = fileparts(TemplateName); if isempty(e) % default extension e = '.mbt'; end if isempty(p) && exist([f,e], 'file') ~= 2 % default directory - templates are stored in the "Designs" file pref. % Dont ask. p = mbcGetPath('mbcmodel', 'Designs'); end TemplateName = fullfile(p,[f,e]); % Need to check that the requested file exists on the local machine if exist(TemplateName, 'file') ~= 2 error(message('mbc:mdevproject:InvalidArgument')); end % load from file Ti = struct2cell(load('-mat',TemplateName)); T = Ti{1}; if ~isa(T, 'mdevtestplan') error(message('mbc:mdevproject:InvalidArgument1')); end pTP= xregpointer(T); if pTP~=0 MP= AddChild(MP,pTP); if nargin>2 % Name new testplan pTP.name(NewName); end % Get the heap copy T = info(pTP); end