フィルターのクリア

fprintf in Gui text box

14 ビュー (過去 30 日間)
Jamie Shelley
Jamie Shelley 2016 年 4 月 16 日
コメント済み: Image Analyst 2020 年 2 月 28 日
I have a text box in my Gui, and I need to put some code inside it. I origionaly had an fprintf function (which worked on the main code, but now I'm putting it into a Gui and can't work out how to make the GUI display the text that would have come up in my fprintf function if it was still in the main code - can anyone help please?
  1 件のコメント
Rena Berman
Rena Berman 2017 年 1 月 20 日
(Answers Dev) Restored Question.

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

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 16 日
編集済み: Azzi Abdelmalek 2016 年 4 月 16 日
Use sprintf instead of fprintf
set(handles.edit1,'string', sprintf(your_string))
  2 件のコメント
sreeja balajisundararajan
sreeja balajisundararajan 2020 年 2 月 28 日
what is meant by edit1
Image Analyst
Image Analyst 2020 年 2 月 28 日
That is the name of your control. So in GUIDE, if you have an edit text box on your form, double click it to bring up the property inspector, and look at the "Tag" property. It might say edit1, or it might say something else, like edit2 or whatever name you made it. You can replace the Tag in GUIDE to (almost) whatever you want, and if you do that then with Azzi's code you would replace edit1 with whatever you named your control. It has to match up in GUIDE and in your m-file.

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


Image Analyst
Image Analyst 2016 年 4 月 16 日
With recent versions:
handles.text1.String = theString; % or maybe it's handles.text1.string (lower case string - not sure).
  1 件のコメント
Valentin Risteski
Valentin Risteski 2017 年 11 月 13 日
編集済み: Valentin Risteski 2017 年 11 月 13 日
Great this works! it prints out the result(numerical) on the GUI static text but depends can be used to print out the result on edit box as well. In my case:
handles.text1.String = Perimeter; %for static text
handles.edit1.String = Area; %for edit box

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

カテゴリ

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