Clear Filters
Clear Filters

Problem with 'pause' when I generate an .exe

3 views (last 30 days)
Set Rubio
Set Rubio on 26 Aug 2015
Commented: Filippo Piatti on 20 Nov 2015
I need take a data of a cursor in my program.
I do that in this way:
datacursormode on;
pause;
datacursormode off;
dcm_obj = datacursormode(superficie);
C=dcm_obj.getCursorInfo.Position;
I put the command "pause" because the next lines needed to wait that the user select the point.
It run perfectly when I execute this program in matlab.
But when I generate the .exe and I run the program, the program never past of this point.
After that I use an "imread"
im=imread('imagen.png');
I put the pictur in the .exe folder so I think this is not the problem, but I mention it just in case it was important.
Sorry for my English. Thanks in advance
  1 Comment
Filippo Piatti
Filippo Piatti on 20 Nov 2015
Dear Rubio, I recently came across extacly the same problem. As far as I understood, Matlab pause() command have some stability and accuracy issues (many posts suggest using java threads instead), and surely cannot be compiled in standalone apps. So, what I did was to solve the problem not using pause but with a simpler and more stable msgbox, as below:
uiwait(msgbox('Press ok'));
Overall, the user must give a keyboard input in both the cases (pause and uiwait), but the second one...works!
I hope this solution may be suitable also for your case. If you find out any smarter one, please let me know!
Best Filippo

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Compiler SDK in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!