Matlab GUIDE Display Temp Sensor Data
9 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I'm working on a project where I need to take the ambient temperature via a temp sensor connected to an arduino, and display it on a GUIDE created interface. Is there a way to simply display the temperature from the sensor in a text box? (e.g. "75.4") Most of the forums only have it displayed graphically.
Thanks!
0 件のコメント
回答 (1 件)
Geoff Hayes
2014 年 4 月 19 日
Hi Leah,
If you have the handle to the text box, then you can simply set the string text within that box to your temperature:
set(txtBoxHandle,'String', num2str(tempVar));
The handle to the text box should be relatively easy to obtain. Hope this helps!
Geoff
2 件のコメント
Geoff Hayes
2014 年 4 月 19 日
The text box handle is determined at run time and can be accessed in the *.m code. If you look in the code, you should see several functions that are auto-generated and have as (usually) the last input a parameter called 'handles'. It is within this structure that you can get the handle to the text box as follows: when a widget (button, text box, edit box, etc.) is added to the GUI, one of its properties is called Tag. This tag is usually auto-generated with the type of the widget and the number. So if you add a third text widget to your GUI, its tag may be something like 'text3'. (You can change this to whatever you want though.). But you use this tag to get the handle in the code: handles.text3
It may be a little more tricky to get the handle if your update function doesn't have the handles input parameter but it can still be done.
参考
カテゴリ
Help Center および File Exchange で MATLAB Support Package for Arduino Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!