2

I'm trying to launch a simulink simulation using python script ( mlabwrap as python wrapper for matlab ). I open the simulink *.mdl file using:

open_system("thermo","loadonly");

I use set_param to initialize the simulation:

set_param("thermo", 'SimulationCommand', 'start');

This throws the following error:

An error occurred when changing the simulation execution status. This may occurif a memory allocation failed or if you have no X connection

If I just execute sim("thermo") everything works.

Unfortunatelly I would like to use set_param instead of sim.

How can I use set_param("thermo", 'SimulationCommand', 'start'); and run it from terminal, without X server?

I'm using Matlab2009b on Ubuntu.

EDIT:

As it turned out, if I ran the simulation logged in as a user with X server, the everything works even with set_param ...

But I still wonder, if it is possible to run the simulation, without the X server running...

Michal Gallovic
  • 4,109
  • 2
  • 18
  • 25

1 Answers1

1

As it turned out, you cannot start simulation using set_param without the X server:

"If you use matlab -nodisplay to start a session, you cannot use set_param to run your simulation."

EDIT: official docs link ( as @Daniel pointed out )

Michal Gallovic
  • 4,109
  • 2
  • 18
  • 25
  • 1
    [alternative link to the official documentation](http://www.mathworks.com/help/simulink/ug/using-the-set-param-command.html) (Contents is identical) – Daniel Jan 25 '16 at 20:54
  • @Daniel am I right? (was not 100% ) matlab -nodisplay can be run without the x server, where set_param cannot be used to start the simulation, what basically means - set_param requires x server in order to start the simulation ? – Michal Gallovic Jan 25 '16 at 20:57
  • I don't have any experience running matlab without x server, I can not answer your question. – Daniel Jan 25 '16 at 22:49