How to change char array matrix to numerical matrix in gui

1 回表示 (過去 30 日間)
Isma Adlin Ad
Isma Adlin Ad 2020 年 11 月 29 日
コメント済み: Isma Adlin Ad 2020 年 11 月 29 日
function testerror_Callback(hObject, eventdata, handles) C1_Callback(@C1_Callback, eventdata, handles); C2_Callback(@C2_Callback, eventdata, handles); C3_Callback(@C3_Callback, eventdata, handles); a=get(handles.answer_C1,'String') b=get(handles.answer_C2,'String') c=get(handles.answer_C3,'String')
This answer from command window c =
4×8 char array
'0.15625 '
'-2.28125'
'8.59375 '
'-2.46875'
I want to make it numeric, the number from (1,1) to (1,4) using to calculate another formula

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 29 日
編集済み: Ameer Hamza 2020 年 11 月 29 日
Try str2num()
c = [
'0.15625 '
'-2.28125'
'8.59375 '
'-2.46875'];
x = str2num(c)
Result
>> x
x =
0.1562
-2.2812
8.5938
-2.4688
  1 件のコメント
Isma Adlin Ad
Isma Adlin Ad 2020 年 11 月 29 日
C cannot changed because it is from command window and the value C extract from callback function, i have tried this X = str2num(c) The value is Nan

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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by