How to check the type of input

How would I be able to check for the correct input value for a function, say I'm expecting a number but instead they put in a character?

 採用された回答

Mischa Kim
Mischa Kim 2014 年 3 月 1 日
編集済み: Mischa Kim 2014 年 3 月 1 日

0 投票

Sarah, use the isnumeric command (see example here). Or use validateattributes as a more advanced concept.

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 1 日
編集済み: Azzi Abdelmalek 2014 年 3 月 1 日

0 投票

Use class function
s='err'
class(s)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

質問済み:

2014 年 3 月 1 日

編集済み:

2014 年 3 月 1 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by