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?

 Akzeptierte Antwort

Mischa Kim
Mischa Kim am 1 Mär. 2014
Bearbeitet: Mischa Kim am 1 Mär. 2014

0 Stimmen

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

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 1 Mär. 2014
Bearbeitet: Azzi Abdelmalek am 1 Mär. 2014

0 Stimmen

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

Kategorien

Mehr zu Programming finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by