iskeyword
Test whether a string is a reserved keyword.
Syntax
Section titled “Syntax”tf = iskeyword(str)list = iskeywordDescription
Section titled “Description”With a string argument, returns true if str is a reserved language keyword (if, for, function, end, etc.) — names that cannot be used as variables. Without arguments, returns a cell array of all keywords.
Examples
Section titled “Examples”iskeyword('for') % 1iskeyword('foo') % 0iskeyword % {'break'; 'case'; 'classdef'; ...}See also
Section titled “See also”isvarname— Test whether a string is a valid variable name.