how to transfrer data in guide ?

1 回表示 (過去 30 日間)
Itzik Ben Shabat
Itzik Ben Shabat 2013 年 1 月 13 日
Hi, I have built a UI in guide. I have created an "edit text" function. I wish to allow the user to insert a numeric value and have that value saved and reused in other functions in my program. the problem is that if the user does not insert a value an error occurs. how can i assign a default value (and have it usable in all functions in the program)? thanks

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 13 日
編集済み: Azzi Abdelmalek 2013 年 1 月 13 日
In you opening function insert a code below:
set(handles.edit1,'string','YourDefaultValue')
Which functions? to read your value just use
YourValue= str2double(get(handles.edit1,'string'))
You can also use guidata to transfer your data
  1 件のコメント
Itzik Ben Shabat
Itzik Ben Shabat 2013 年 1 月 13 日
i tried guidata but for some reason it didnt save it... (i used it several times in my program and it worked fine but for this speceific application it didnt).
what you said worked, thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by