フィルターのクリア

How to convert string to number?

2 ビュー (過去 30 日間)
akshatha nayak
akshatha nayak 2019 年 5 月 6 日
編集済み: Stephen23 2019 年 5 月 6 日
we have extracted a value from GUI using
id1=get(handles.id1,'String');
Now i want to check if the value is a number. How do i do this?
If the value is a number that is converted to a string using the above line, how do I convert it back to a number?
  1 件のコメント
KSSV
KSSV 2019 年 5 月 6 日
Read about ischar, str2num, num2str,

サインインしてコメントする。

回答 (1 件)

Stephen23
Stephen23 2019 年 5 月 6 日
編集済み: Stephen23 2019 年 5 月 6 日
"...how do I convert it back to a number?"
Convert to numeric:
num = str2double(id1)
"Now i want to check if the value is a number"
isn = ~isnan(num)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by