Why is "startup.m" file affecting the execution of "parpool" command?

8 views (last 30 days)
I have a "startup.m" file in which a pop-up window is displayed to the user in order to change the working directory at MATLAB startup.
However, it seems like it is affecting the execution of "parpool" command: such command is hanging forever when I use this "startup.m" file. Why?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Sep 2020
The "startup.m" is opening a dialogue window on all of the workers and requesting a response from the user. The workers then wait on that dialogue window forever. This is the reason why "parpool" command is hanging forever.
This is happening because the "startup.m" file is on the path of the MATLAB workers on the same machine. MATLAB workers share the same path as the MATLAB client and execute the "startup.m" on initialization.
Workaround:
The "startup.m" file should be modified such that the interactive/problematic sections are executed only by the MATLAB client and not by MATLAB workers.
if (~java.awt.GraphicsEnvironment.isHeadless())
<code that we only want to happen on client>
end
Or:
if (usejava('desktop'))
<code that we only want to happen on client>
end

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!