how can i show a numerical output in gui

i am using the following gui code
function guitrial
voltageH = uicontrol('Style', 'PushButton', 'String', 'Voltage', ...
'Position', [10, 200, 100, 24], ...
'Callback', {@dataaq});
ValueH = uicontrol('Style', 'edit', 'String', '0', ...
'Position', [10, 150, 100, 24]);
here the callback function gives a numerical result (that i put in a variable) but it is shown in the command window.how can i get the result in the static box? it will be very helpful if you give me the code or example.thanks

 採用された回答

Matt Fig
Matt Fig 2012 年 10 月 22 日
編集済み: Matt Fig 2012 年 10 月 22 日

0 投票

Give this a try:
function guitrial
S.voltageH = uicontrol('Style', 'PushButton',...
'String', 'Voltage', ...
'Position', [10, 200, 100, 24], ...
'Callback', {@dataaq});
S.ValueH = uicontrol('Style', 'edit', 'String', '0', ...
'Position', [10, 150, 100, 24]);
guidata(gcf,S)
function [] = dataaq(varargin)
D = randi(10); % Say your program returns this.
S = guidata(gcbf);
set(S.ValueH,'string',num2str(D));

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimultaneous and Synchronized Operations についてさらに検索

質問済み:

2012 年 10 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by