zemax与matlab调用程序

源代码在线查看: docgen.m.bak

软件大小: 5468 K
上传用户: wewe1111
关键词: matlab zemax 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				% Docgen script				% This script generates documentation from all the help text of the .m files in the toolbox.				% Usage : docgen				%				% See Also : Census								% MZDDE - The ZEMAX DDE Toolbox for Matlab.				% Copyright (C) 2002-2004 Defencetek, CSIR				% Contact : dgriffith@csir.co.za				% 				% This file is part of MZDDE.				% 				%  MZDDE is free software; you can redistribute it and/or modify				%  it under the terms of the GNU General Public License as published by				%  the Free Software Foundation; either version 2 of the License, or				%  (at your option) any later version.				%				%  MZDDE is distributed in the hope that it will be useful,				%  but WITHOUT ANY WARRANTY; without even the implied warranty of				%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the				%  GNU General Public License for more details.				%				%  You should have received a copy of the GNU General Public License				%  along with MZDDE (COPYING.html); if not, write to the Free Software				%  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA				%												% Copyright 2004, Defencetek, CSIR				%				% This file is part of MZDDE, the ZEMAX DDE Toolbox for Matlab.				%				%    This Matlab toolbox is free software; you can redistribute it and/or 				%    modify it under the terms of the GNU General Public License as published				%    by the Free Software Foundation; either version 2 of the License, or				%    (at your option) any later version.				%				%    This toolbox is distributed in the hope that it will be useful,				%    but WITHOUT ANY WARRANTY; without even the implied warranty of				%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the				%    GNU General Public License for more details.				%				%    You should have received a copy of the GNU General Public License				%    along with this toolbox (see COPYING.html); if not, write to the 				%    Free Software Foundation, Inc., 59 Temple Place, Suite 330,				%    Boston, MA  02111-1307  USA				%				% $Revision:$								myself = which('docgen'); % Get the directory from which this docgen is running (presumably)				[mypath,name,ext,versn] = fileparts(myself); % Get the path								% Now get all the .m files				mfiles = dir([mypath '\*.m']);								% Get a list of all functions and scripts, but exclude the Contents				mnames(1).name = 'MZDDE';				j = 2;				for i = 1:length(mfiles)				    if strcmp(mfiles(i).name,'Contents.m') ~= 1				        mnames(j).name = mfiles(i).name(1:(end-2));				        j = j + 1;				    end				end												% Open a html file for the output				docfid = fopen([mypath '\Documents\MZDDE Function Reference.html'], 'w');				% Write the HTML file headers				fprintf(docfid, '\n\n');				fprintf(docfid, '\n');				fprintf(docfid, '\n');				fprintf(docfid, 'MZDDE Function Reference\n');				fprintf(docfid, '\n\n');								% Loop through all .m files and get the help text				for i = 1:length(mfiles)				    helptext = help(mnames(i).name);				    fprintf(docfid,'\n');				    fprintf(docfid, ['' mnames(i).name '\n']);				    % replace all % signs with a %%				    helptext = strrep(helptext, '%', '%%');				    % replace all \ with \\				    helptext = strrep(helptext, '\', '\\');				    % put mailto and CSIR links in				    helptext = strrep(helptext, 'dgriffith@csir.co.za', 'Derek Griffith');				    helptext = strrep(helptext, 'CSIR', 'CSIR');				    helptext = strrep(helptext, 'COPYING', 'COPYING');				    % helptext = strrep(helptext, 'ZEMAX', 'ZEMAX');				    helptext = strrep(helptext, 'Matlab', 'Matlab');				    				    				    % do a search and replace on all the names is the help text, and insert a link				    for j = 2:length(mnames)				        helptext = strrep(helptext, [' ' mnames(j).name ' '], [' ' mnames(j).name ' ']);				        helptext = strrep(helptext, [' ' mnames(j).name ','], [' ' mnames(j).name ',']);				        helptext = strrep(helptext, [' ' mnames(j).name '.'], [' ' mnames(j).name '.']);				        helptext = strrep(helptext, [' ' mnames(j).name ')'], [' ' mnames(j).name ')']);				        helptext = strrep(helptext, [' ' mnames(j).name char(10)], [' ' mnames(j).name '' char(10)]);				    end				    fprintf(docfid,'\n');    				    fprintf(docfid, helptext);				    fprintf(docfid,'\n');				    fprintf(docfid,'\n');				end								fprintf(docfid, '\n\n');				fclose(docfid);							

相关资源