How to call simulink model(.slx) from script
02:53 07 Jun 2017

I'm a super beginner in Simulink models and control systems. I have .slx Simulink model for drone dynamics system. It takes in two inputs (roll cmd, pitch cmd) and outputs velocity x, velocity y, position x, and position y.

From here, it seems like I can open the system by calling

open_system('myModel.slx', 'loadable');

simulink model

But how do I put inputs and get output values? Is there a way I can do this in a gui?

EDIT: Here is the full layout of my model:enter image description here

When I did

roll_CMD=10;
pitch_CMD=20;

I got a warning saying:

Input port 1 of 'SimpleDroneDynamics/...' is not connected.
  1. How do I feed inputs using port numbers?
  2. How do I get outputs with port numbers? I tried

    [vx, vy, px, py] = sim('SimpleDroneDynamics.slx');

and got an error saying

Number of left-hand side argument doesn't match block diagram...
  1. Is there a way to continuously feed inputs at every time step? This being controller module, I think I'm supposed to feed in different values based on output position and velocity.

EDIT2: I'm using Matlab2017a

matlab simulink