how to print output in gui

55 ビュー (過去 30 日間)
Dimple
Dimple 2013 年 8 月 5 日
prompt{1}='Enter a value :';
prompt{2}='Enter b value :';
title='addition';
answer=inputdlg(prompt,title);
in the above code, how to add and disply the output

採用された回答

Evan
Evan 2013 年 8 月 5 日
編集済み: Evan 2013 年 8 月 5 日
You could create a editbox in a figure and display the value there:
Example:
fh = figure;
prompt = {1 3};
eh = uicontrol('Style','edit','String',num2str(prompt{1} + prompt{2}));
For ways of customizing your editbox, including its position, read up on uicontrol properties: http://www.mathworks.com/help/matlab/ref/uicontrol_props.html
For more sophisticated GUIs, you may want to look into GUIDE: http://www.mathworks.com/help/matlab/creating_guis/ways-to-build-matlab-guis.html

その他の回答 (2 件)

Suman Saha
Suman Saha 2013 年 8 月 7 日
figure('Name','Di')
prompt = {4 5 5 1 3};
uicontrol('Style','text','unit','inches','position',[1 1 1 1],'String',sum(cell2mat(prompt)));
uicontrol('Style','text','String','The sum','unit','inches','position',[1 2 1 0.5]);

David Sanchez
David Sanchez 2013 年 8 月 7 日
A more simple approach is the use of set:
set(handles.your_text_object_in_GUI,'String','your_string_to_display');
In your GUI, every object has a tag (see the property inspector), just change your_text_object_in_GUI by the tag of your text object.

カテゴリ

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