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

📄 isvarname.m

📁 电力系统的psat
💻 M
字号:
function t = isvarname(s)
%ISVARNAME True for valid variable name.
%   ISVARNAME(S) is true if S is a valid MATLAB variable name.
%   A valid variable name is a character string of letters, digits and
%   underscores, with length <= namelengthmax and the first character a letter.

%   Copyright 1984-2002 The MathWorks, Inc. 
%   $Revision: 1.7 $  $Date: 2002/04/26 03:56:46 $
%   $Adjusted for Matlab 5.3 by F. Milano $  $Date: 2003/09/15 $

t = ischar(s) & size(s,1) == 1 & length(s) <= 16;
if t
  t = isletter(s(1)) & all(isletter(s) | s == '_' | ('0' <= s & s <= '9'));
  t = t & ~iskeyword(s); 
end

%-----------------------------------------------------------------------------
function L = iskeyword(s)
%ISKEYWORD Check if input is a keyword.
%   ISKEYWORD(S) returns one if S is a MATLAB keyword,
%   and 0 otherwise.  MATLAB keywords cannot be used 
%   as variable names.
%
%   ISKEYWORD used without any inputs returns a cell array containing
%   the MATLAB keywords.
%
%   See also ISVARNAME.

%   $Revision: 1.3 $  $Date: 2002/04/08 23:29:22 $
%   Copyright 1984-2002 The MathWorks, Inc.

L = {...
    'break',
    'case',
    'catch',
    'continue',
    'else',
    'elseif',
    'end',
    'for',
    'function',
    'global',
    'if',
    'otherwise',
    'persistent',
    'return',
    'switch',
    'try',
    'while',
    };

if nargin==0
%  Return the list only
  return
else
  L = any(strcmp(s,L));
end

⌨️ 快捷键说明

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