MATLAB: Does engOpen return before MATLAB is finished initializing when MATLAB calls a system command on startup

concurrencydosengineMATLABmatlabrcstartupsystem

Why does engOpen return before MATLAB is finished initializing when MATLAB calls a system command on startup?
As part of my matlabrc.m or startup.m, MATLAB makes a call to a system command via the DOS, UNIX, or SYSTEM functions. My call to engOpen returns before that command is done processing therefore its return values are not initialized in the MATLAB workspace.
This behavior is limited to calls to DOS or SYSTEM that MATLAB performs on startup.

Best Answer

This enhancement has been incorporated in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
This has been verified as a bug in MATLAB 6.5 (R13) in the way that the MATLAB Engine evaluates calls to system functions. As a workaround, set a flag after the system call has terminated and test that before proceeding with your MATLAB Engine application.