📄 gm_percentsub.m
字号:
function outstring = gm_percentsub(instring, pre, post)
%% gm_percentsub: replace percent-sign markers with actual coordinates.
%% outstring = gm_percentsub(instring, pre, post)
%% Given a string with percent signs followed by a number, say %2
%% this routine substitutes P2Q for %2, where p is the argument pre
%% and Q is the argument post.
%% This routine is called by gmsize_control, gm_conductivity, gm_source,
%% and gm_bdrycond.
outstring = '';
h = find(instring == '%');
prev = 1;
while length(h) > 0
j = h(1) + prev - 1;
outstring = [outstring, instring(prev:j-1), pre];
snum = '';
prev = find(instring(j+1:end) < '0' | instring(j+1:end) > '9');
if length(prev) == 0
prev = length(instring) + 1;
else
prev = prev(1) + j;
end
outstring = [outstring, instring(j+1:prev - 1), post];
h = find(instring(prev:end) == '%');
end
outstring = [outstring,instring(prev:end)];
% ------------------------------------------------------------------
% Copyright (c) 1998 by Cornell University. All rights reserved.
% See the accompanying file 'Copyright' for authorship information,
% the terms of the license governing this software, and disclaimers
% concerning this software.
% ------------------------------------------------------------------
% This file is part of the QMG software.
% Version 2.0 of QMG, release date RELDATE
% ------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -