string that may or may not need to be converted to num...
Mostra commenti meno recenti
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!
Risposta accettata
Più risposte (1)
Walter Roberson
il 24 Set 2018
1 voto
str2double() and test for nan, keep the original if you got nan.
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!