Displaying a Value in a static text box

Using GUI GUIDE what is the code to get an output from a equation/code that is in the GUI code, which is assigned to a variable, to display in a static text box.
More info: I have a GUI that grabs a set of data from an excel file with two columns and assigns one column to X and another to Y and then runs this through the Simpson 1/3 function in MATLAB and assigns that value to C. How do i get the variable C to display in the static Text box?

 採用された回答

Image Analyst
Image Analyst 2014 年 11 月 24 日

6 投票

textLabel = sprintf('Variable C = %f', C);
set(handles.text1, 'String', textLabel);

1 件のコメント

Walter Roberson
Walter Roberson 2017 年 5 月 31 日
If you are defining a function, then
function DisplayThem(handles, A,B,C,D)
text11 = sprintf('%0.4f', A);
set(handles.text1,'String',text11);
text12 = sprintf('%0.4f', B);
set(handles.text2,'String',text12);
text13 = sprintf('%0.4f', C);
set(handles.text3,'String',text13);
text14 = sprintf('%f', D);
set(handles.text4,'String',text14);
But perhaps your line
[RN1,RN2,RN3,RN4] = function(A,B,C,D);
was just an unfortunate use of the reserved word "function" and should have been some function name. If so then that code would be okay provided that handles.text1 and so on had already been created as uicontrol('style','text')

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

タグ

質問済み:

Ben
2014 年 11 月 24 日

コメント済み:

2017 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by