remstr.m
来自「有关matlab的电子书籍有一定的帮助希望有用」· M 代码 · 共 36 行
M
36 行
function outstr = remstr(instr,rem)
% REMSTR Remove string from callback string.
% STR1 = REMSTR(STR,REM) removes all occurrences of string REM from
% string STR.
% Removes a preceding comma if there is one and nothing following.
% Copyright (c) 1988-98 by The MathWorks, Inc.
% $Revision: 1.5 $
% T. Krauss 11/21/94
if length(rem) == 0
outstr = instr;
else
if length(rem)>length(instr)
outstr = instr;
else
outstr = instr;
ind = findstr(outstr,rem);
for i = 1:length(ind)
outstr(ind(i)-(i-1)*length(rem)+(0:length(rem)-1)) = [];
end
% now remove trailing comma separator if present
if length(outstr)>0
ind = length(outstr);
while (outstr(ind)==' ')
ind = ind-1;
end
if instr(ind)==','
outstr(ind:length(outstr)) = [];
end
end
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?