MATLAB Answers


Why does my MATLAB Builder JA code run slower when run on the EDT in MATLAB Builder JA 2.0.4 (R2009b)

Asked by Murugavel Sivagnanam on 12 Jan 2011

If I run MATLAB Builder JA code in the main body of my pplication or on a "normal" separate Thread; the code executes about as fast as in MATLAB. When I use a thread on the EDT however, I notice the methods take much longer to complete. What is causing this?


1 Answer

Answer by Murugavel Sivagnanam on 12 Jan 2011

To prevent GUIs from locking up when calling into a MATLAB Builder JA created class, the com.mathworks.toolbox.javabuilder pacakge manually allows other threads on the EDT to execute first. This will lead to your own thread on the EDT being interrupted which leads to a decrease in performance.

So apart from the fact that running CPU intensive operations (which your MATLAB routines usually are) on the EDT is not a good idea in general (as it will lead to sluggish GUI behavior). You also should not run the MATLAB Builder JA code on the EDT as it will decrease its performance


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!