string that may or may not need to be converted to num...
이전 댓글 표시
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!
채택된 답변
추가 답변 (1개)
Walter Roberson
2018년 9월 24일
1 개 추천
str2double() and test for nan, keep the original if you got nan.
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!