作者mp19990920 (郝渴连)
看板MATLAB
标题Re: [讨论] 同时两视窗运算
时间Mon Mar 19 10:22:47 2012
酒精你好:
请把以下的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