📄 isrealvarname.m
字号:
function retval = isrealvarname(testname)
%ISREALVARNAME True for valid variable name.
% ISREALVARNAME(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.
%
% See also ISKEYWORD, ISVARNAME, NAMELENGTHMAX.
%
% Revised, since the Windows version returns true for INVALID names!
% Version: v0.6e
% Build: 7041710
% Date: Apr-17 2007, 10:02 AM CEST
% Author: Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools
% argument check
if nargin < 1
error( ...
'BVQXtools:TooFewArguments',...
'Too few arguments. Try ''help %s''.',...
mfilename ...
);
end
% test only valid char inputs
if ischar(testname) && ...
~isempty(testname) && ...
numel(testname) == size(testname, 2) && ...
all(double(testname) < 123 & double(testname) > 47) && ...
testname(1) > 64 && ...
(testname(1) < 90 || ...
testname(1) > 96) && ...
isempty(intersect(testname, char([58:64, 91:94, 96])));
retval = true;
else
retval = false;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -