Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

iskeyword - Determine whether input is MATLAB keyword

Syntax

tf = iskeyword('str')
iskeyword str
iskeyword

Description

tf = iskeyword('str') returns logical 1 (true) if the string str is a keyword in the MATLAB language and logical 0 (false) otherwise.

iskeyword str uses the MATLAB command format.

iskeyword returns a list of all MATLAB keywords.

Examples

To test if the word while is a MATLAB keyword,

iskeyword while
ans =
    1

To obtain a list of all MATLAB keywords,

iskeyword
    'break'
    'case'
    'catch'
    'classdef'
    'continue'
    'else'
    'elseif'
    'end'
    'for'
    'function'
    'global'
    'if'
    'otherwise'
    'parfor'
    'persistent'
    'return'
    'spmd'
    'switch'
    'try'
    'while'

See Also

isvarname, genvarname, is*

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS