Documentation

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

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. MATLAB keywords cannot be used as variable names.

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'

Introduced before R2006a

Was this topic helpful?