MATLAB: “Connect to Target” command from Matlab to Simulink

real time workshopsimulinksimulink coderSimulink Desktop Real-Time

Hello:
I am currently working on a remote laboratory in the area of control theory. I am using Simulink and the Real Time Windows Target to control a Servomotor in a simple PI control scheme.
I am using a Java applet to comunicate via internet with Matlab. The Java applet can obtain data from the Matlab workspace and can also issue commands. With this I can control the simulink model to run, obtain data, and chage parameters as needed.
The only thing I cannot do is to order the Simulink model to _Connect to Target_. For those who are not familiar with this, it is a button that appears on the simulink toolbar. Since I am doing a remote laboratory, I would like to be able to command this button from the MatLab command line (as one can control the Run button).
Thank you for your help,
Eduardo Garcia

Best Answer

set_param(gcs,'SimulationCommand','connect');
Read from here.