Re: [討論] 同時兩視窗運算
酒精你好:
請把以下的code全部存成test.m
-----------------------------------------------------------------------
function test
f1 = figure('Position', [50, 100, 150, 50], 'Menubar', 'none');
f2 = figure('Position', [50, 200, 150, 50], 'Menubar', 'none');
uicontrol(f1, 'String', '0', 'Callback', {@addanother});
uicontrol(f2, 'String', '0', 'Callback', {@addanother});
end
function addanother(src, evnt)
hAll = allchild(0);
hAnother = setdiff(hAll, ancestor(src, 'Figure'));
hText = findobj('Parent', hAnother);
curNumber = str2num(get(hText, 'String'));
set(hText, 'String', num2str(curNumber+1))
end
-----------------------------------------------------------------------
你可以參考Matlab的help中的以下章節:
Function Reference
Graphics
Handle Graphics
Creating Graphical User Interface(全)
Handle Graphics Object Properties
以及Creating Graphical User Interfaces的pdf檔
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.21.63.132
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
討論
0
4