MATLAB Answers

Cursor location found much faster in mfile than in compiled exe. How to fix?

2 views (last 30 days)
KAE on 17 Jul 2017
Commented: KAE on 24 Jul 2017
I have a mfile which finds the location of the user's cursor in an axis, and each identified location is the basis for calculations. The results are displayed quickly, seemingly concurrent with the cursor motion. When I run an exe executable compiled from the same mfile, however, results are displayed slowly, as if the exe is struggling to keep up with the cursor's motion unless I move it very slowly. I am running R2015b and compiling with the Application Compiler tool, and the mfile is part of a GUI. Are there any known issues that might be slowing the exe?


Sign in to comment.

Accepted Answer

Harsh on 20 Jul 2017
Edited: Harsh on 20 Jul 2017
Based on your description of the issue, it appears that you are deploying a GUI that utilizes the .m file which finds the user's cursor in an axis. There are a few known bugs that were fixed for the latest R2017a release of MATLAB. You can learn more about these bugs such as (1314781,1504736 etc.) here. Consequently, if you have an active Software Maintenance Service, you can try building your application from R2017a instead.
However, please note that the first time you start a MATLAB compiled executable it has to initialize the MATLAB Runtime Environment as well as extract and create the mcr directory. This a one time operation. It should then however run as in base MATLAB.
While there could be other causes for this behavior, you can debug this using the following options assuming you are on a Windows machine:
Using deploytool -> application compiler -> Additional runtime settings
  • Un-check the "Do not display the Windows Command Shell..." option
  • Check the "Create log file" box
Later, inspect both the Windows console and the log file for further details on the cause of this behavior.
If the issue persists, please contact MathWorks Technical Support here:
Please be sure to provide a detailed description of the issue and attach any relevant files / code / examples required to investigate the issue.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by