ATTACHM attach the m file being executes to the analysis object. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ATTACHM attach the m file being executes to the analysis object. CALL: ao = attachm(ao, 'foo.m'); VERSION: $Id: attachm.m,v 1.7 2008/03/01 16:09:02 hewitson Exp $ HISTORY: 31-03-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function a = attachm(a, mfile) 0002 % ATTACHM attach the m file being executes to the analysis object. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: ATTACHM attach the m file being executes to the analysis object. 0007 % 0008 % CALL: ao = attachm(ao, 'foo.m'); 0009 % 0010 % VERSION: $Id: attachm.m,v 1.7 2008/03/01 16:09:02 hewitson Exp $ 0011 % 0012 % HISTORY: 31-03-07 M Hewitson 0013 % Creation 0014 % 0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0016 0017 VERSION = '$Id: attachm.m,v 1.7 2008/03/01 16:09:02 hewitson Exp $'; 0018 CATEGORY = 'Helper'; 0019 0020 % Check if this is a call for parameters 0021 if nargin == 2 0022 if isa(a, 'ao') && ischar(mfile) 0023 in = char(mfile); 0024 if strcmp(in, 'Params') 0025 a = plist; 0026 return 0027 elseif strcmp(in, 'Version') 0028 a = VERSION; 0029 return 0030 elseif strcmp(in, 'Category') 0031 a = CATEGORY; 0032 return 0033 end 0034 end 0035 end 0036 0037 0038 [pathstr,name,ext,vers] = fileparts(mfile); 0039 if isempty(ext) 0040 mfile = [mfile '.m']; 0041 end 0042 min = textread(mfile,'%s','delimiter','\n','whitespace',''); 0043 mout = ''; 0044 for j=1:length(min) 0045 mout = [mout '\n' min{j}]; 0046 end 0047 a.mfile = mout; 0048 a.mfilename = strrep(mfile, '''', '`'); 0049 0050