"Bruno Luong" <firstname.lastname@example.org> wrote in message <email@example.com>... > "Arda " <firstname.lastname@example.org> wrote in message <email@example.com>... > > The main task here is to ensure that program waits the user to terminate it when compiled without a figure! > > Can you use waitfor in one of the java objects? Such as > > waitfor(frame, 'Visible','off') > > Bruno
I didnt even try the waitfor because i had assumed that it needed a valid matlab handle something like javacompenent gives. It turns out that java components are also used with waitfor. But i am not sure exactly what 'waitfor' actually waits for; because when i close the java frame it still waits :) Then i tried something else, i changed the closing callback as follows; frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); Guess what, when i close the frame now it also closes Matlab :) But surprisingly it worked for standalone. Program is terminated only when i close the window. I think using with 'isdeployed' might be a solution..