Why does the MENU method place dynamic buttons in a different window in MATLAB R2013b?

1 view (last 30 days)
I am using the MENU method and passing static and dynamic inputs to it. I also have another figure window that plots some data every x seconds as shown in the code below. I noticed that sometimes the MENU buttons are placed in the other figure window. Why does this happen?
function foo()
f = figure;
NumberFrameDisplayPerSecond = 10;
tmr = timer('TimerFcn', {@timerFcn, f},'Period',1/NumberFrameDisplayPerSecond,'ExecutionMode','fixedRate','BusyMode','drop');
start(tmr)
tic
stopMenu = false;
while ~stopMenu
t = sprintf('%s',toc);
choice = menu('stuff','stop',t);
switch choice
case 1
stopMenu = true;
otherwise
end
end
stop(tmr)
delete(tmr)
function timerFcn(src, evt, f)
figure(f)
plot(rand(10,1));

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 12 Dec 2013
This is a bug with the MENU method where the parent figure is not being set while creating the objects that go on the MENU. 
To work around this issue, use the attached MYMENU method. 

More Answers (0)

Products


Release

R2013a

Community Treasure Hunt

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

Start Hunting!