我只是 MATLAB GUI 的初学者,只想知道简单的方法来做到这一点。
我有四个小部件:2 个列表uicontrol
、1 个按钮uicontrol
和 1 个静态文本uicontrol
。
function pushbutton1_Callback(hObject, eventdata, handles)
x =get(handles.popupmenu1, 'Value') % getting the value from the popupmenu
% doing something with it
y=get(handles.popupmenu2, 'Value') % getting the value and processing it
% doing something with it
total=x+y
set(handles.text1, 'String', num2str(total)) % set to total...but
% I really want it to be a string with a total. like 'Your total is %s', total
你能帮我设置文本字符串吗?