string that may or may not need to be converted to num...
Afficher commentaires plus anciens
I am bringing a string into a function. I need to convert it to num ONLY if it's intended as a number like 2, 40, 100... but when the user enters it as something else, leave it as a string. Can that be done?
Thanks!
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 24 Sep 2018
1 vote
str2double() and test for nan, keep the original if you got nan.
Catégories
En savoir plus sur Data Type Conversion 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!