loadtpl.m

来自「M2HTML by itself generates an HTML docum」· M 代码 · 共 25 行

M
25
字号
function tpl = loadtpl(tpl,handle)%TEMPLATE/LOADTPL Read a template from file%  TPL = LOADTPL(TPL,HANDLE) read the template file associated with the%  handle HANDLE in the template TPL and store it in the variable HANDLE.%  Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk>%  $Revision: 1.0 $Date: 2003/05/05 22:19:51 $if ~isempty(get(tpl,'var',handle))	return;else	ind = find(ismember(tpl.handles,handle));	if isempty(ind)		error('[Template] No such template handle.');	else		filename = tpl.file{ind};		[fid, errmsg] = fopen(filename);		if ~isempty(errmsg)			error(sprintf('Cannot open template file %s.',filename));		end		tpl = set(tpl,'var',handle,fscanf(fid,'%c'));		fclose(fid);	endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?