Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use set_param() to run a simulation in a MATLAB session that does not have a display. #36

Open
awecefil opened this issue Nov 15, 2023 · 1 comment

Comments

@awecefil
Copy link

Hello,

I'm currently using MATLAB Engine for Python on a Linux system. When I run the following commands:

self.eng = matlab.engine.start_matlab(option="-nodesktop")
self.eng.set_param(self.modelName, 'SimulationCommand', 'start', nargout=0)

I encounter the following error:

matlab.engine.MatlabExecutionError: You cannot use set_param to run a simulation in a MATLAB session that does not have a display.
I found information in the MATLAB documentation (set_param) mentioning that if you start a session with matlab -nodisplay, you cannot use set_param to run a simulation. The -nodisplay mode does not support using set_param for simulation, and it suggests using the sim function instead.

However, I am hesitant to use the sim function because according to the documentation, certain functionalities like pause and continue are not supported.

I would like to understand why I am encountering this issue when I have not explicitly set -nodisplay. Could this be specific to using MATLAB Engine on a Linux system? Is there any recommended method to address this issue on Linux?

Additionally, please find below details about my environment:

Python Version: 3.7
MATLAB Version: R2020a
Operating System: Linux
Your assistance in resolving this matter would be highly appreciated.

Thank you.

@alanfmw
Copy link
Member

alanfmw commented Dec 26, 2023

By default, MATLAB Engine for Python starts MATLAB with the option "-nodesktop". However, if you specify the option "-desktop" (you can leave out "option=", since it's a positional argument):

self.eng = matlab.engine.start_matlab("-desktop")

it will override the default. This would probably be the best thing for you to do, given that you want to run pause and continue (that is, use MATLAB interactively).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants