readtokn.m

来自「该代码为图像融合的vc源程序,对学习图像融合有很重要的价值」· M 代码 · 共 26 行

M
26
字号
function token=readtokn(fileID)
%$Id: readtokn.m,v 1.1.1.1 2000/10/16 09:30:40 mattb Exp $
% token=readtokn(fileID)
%      Returns the next token from the file pointed to by fileID.
%      Tokens are separated by whitespace.
%      A comment starts with a '#' and ends at the end of a line, and
%      is treated like whitespace.
%      The token is returned as an array of characters.

finished=0;
while ~finished
  char=fscanf(fileID,'%c',1);
  % So, what does this char represent?
  if char=='#' % Skip to end of line
    dummy=fgetl(fileID);
  elseif ~isspace(char)
    finished=1;
    token=char;
    while ~isspace(char) & char~='#';
      char=fscanf(fileID,'%c',1);
      token=[token, char];
    end
  end
end

⌨️ 快捷键说明

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