フィルターのクリア

GUI set handles don't pass value

2 ビュー (過去 30 日間)
ZK
ZK 2014 年 3 月 27 日
コメント済み: ZK 2014 年 3 月 28 日
Hi, I have if statement, to change added value in GUI edit text button if it is greater than 16. Right now it isn't working, what I should change in it? Part of code:
function etfM_Callback(hObject, eventdata, handles)
global fM;
fM = get(hObject,'String');
if fM>16
fM = 'NaN';
set(handles.etfM, 'String', fM);
end

採用された回答

Niklas Nylén
Niklas Nylén 2014 年 3 月 28 日
編集済み: Niklas Nylén 2014 年 3 月 28 日
fM = get(hObject,'String') will return a string. To compare it to 16 in the if statement you need to convert it to a number. One option is to make the following change:
fM = str2num(get(hObject,'String'))
  1 件のコメント
ZK
ZK 2014 年 3 月 28 日
True, work, thanks.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by