function t = isvarname(s)
%ISVARNAME Check for a 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 <= 32 and the first character a letter.

%   Copyright (c) 1993-1999 The Mathworks, Inc. All Rights Reserved.
%   $Revision: 1.5 $  $Date: 1999/01/04 21:55:09 $

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