Problem with 'pause' when I generate an .exe

3 次查看(过去 30 天)
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 个评论
Filippo Piatti
Filippo Piatti 2015-11-20
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler SDK 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by