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?

 Réponse acceptée

Mischa Kim
Mischa Kim le 1 Mar 2014
Modifié(e) : Mischa Kim le 1 Mar 2014

0 votes

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

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 1 Mar 2014
Modifié(e) : Azzi Abdelmalek le 1 Mar 2014

0 votes

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

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by