⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scanner.m

📁 matlab 多参数积分工具箱 multivariable calculus toolbox
💻 M
字号:
function token=scanner(str)
%SCANNER  Scan string into tokens.
%   TOKEN = SCANNER(STR), where STR is a character string
%   and TOKEN is the resulting token list as a row vector
%   of string (character matrix).
%
%   See also TOKCAT.

% Copyright (c) 2001-08-19, B. Rasmus Anthin.

len=length(str);
token='';
R=[str ' '];
D=char('(',')','+','-','*','/','\','^');
while ~isempty(R)
   j=1;
   while any(R(j)==D) & j<length(R)
      token=strvcat(token,R(j));
      j=j+1;
   end
   [T,R]=strtok(R,D);
   token=strvcat(token,T);
end

%%take care of derivatives
%for i=1:size(token,1)-4
%   if token(i,1)=='d' & deblank(token(i+1,1))=='/' & token(i+2,1)=='d' & length(token(i+2,:))>1
%      token=strvcat(token(1:i-1,:),strrep([token(i,:) token(i+1,:) token(i+2,:)],' ',''),token(i+3:end,:));
%   end
%end
%tmp='';
%for i=1:size(token,1)
%   if strncmp(token(i,:),'d/d',3) & length(token(i,:))>3
%      tmp=strvcat(tmp,token(i,1:3),token(i,4:end));
%   else
%      tmp=strvcat(tmp,token(i,:));
%   end
%end
%token=tmp;
if all(isspace(token(end,:)))
   token=token(1:end-1,:);
end

⌨️ 快捷键说明

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