Re: [討論] 同時兩視窗運算

看板MATLAB作者 (郝渴連)時間14年前 (2012/03/19 10:22), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
酒精你好: 請把以下的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
文章代碼(AID): #1FPfXwhA (MATLAB)
文章代碼(AID): #1FPfXwhA (MATLAB)