time | Calls | line |
---|
| | 1 | function L = iskeyword(s)
|
| | 2 | %ISKEYWORD Check if input is a keyword.
|
| | 3 | % ISKEYWORD(S) returns one if S is a MATLAB keyword,
|
| | 4 | % and 0 otherwise. MATLAB keywords cannot be used
|
| | 5 | % as variable names.
|
| | 6 | %
|
| | 7 | % ISKEYWORD used without any inputs returns a cell array containing
|
| | 8 | % the MATLAB keywords.
|
| | 9 | %
|
| | 10 | % See also ISVARNAME, MATLAB.LANG.MAKEVALIDNAME
|
| | 11 |
|
| | 12 | % Copyright 1984-2016 The MathWorks, Inc.
|
| | 13 |
|
< 0.001 | 7 | 14 | L = {...
|
| | 15 | 'break'
|
| | 16 | 'case'
|
| | 17 | 'catch'
|
| | 18 | 'classdef'
|
| | 19 | 'continue'
|
| | 20 | 'else'
|
| | 21 | 'elseif'
|
| | 22 | 'end'
|
| | 23 | 'for'
|
| | 24 | 'function'
|
| | 25 | 'global'
|
| | 26 | 'if'
|
| | 27 | 'otherwise'
|
| | 28 | 'parfor'
|
| | 29 | 'persistent'
|
| | 30 | 'return'
|
| | 31 | 'spmd'
|
| | 32 | 'switch'
|
| | 33 | 'try'
|
| | 34 | 'while'
|
| | 35 | };
|
| | 36 |
|
< 0.001 | 7 | 37 | if nargin==0
|
| | 38 | % Return the list only
|
| | 39 | return
|
< 0.001 | 7 | 40 | else
|
< 0.001 | 7 | 41 | try
|
< 0.001 | 7 | 42 | L = any(strcmp(s,L));
|
| | 43 | catch
|
| | 44 | L = false;
|
< 0.001 | 7 | 45 | end
|
< 0.001 | 7 | 46 | end
|
Other subfunctions in this file are not included in this listing.