3 dimensional input port to matlab level 2 s function, inputting data and accessing it in the script

I am trying to create a matlab level 2 s function block in simulink with the following inputs:
%position (x,y,z), rotation_euler (r_x,r_y,r_z), gps (long,lat,alt), vel, heading, yawRate
function setup(block) block.NumInputPorts = 6; block.InputPort(1).Dimensions = 3; block.InputPort(2).Dimensions = 3; block.InputPort(3).Dimensions = 3;
i) What block would I use to feed data into the block in simulink, e.g. say I have 3 constant blocks that provide x,y,z and want to input this into the first input port?
ii) How can I, in the matlab script, access the data? I have tried to backward engineer what the "Simulink.BlockCompInputPortData" class contains by using "fieldnames" but it has not helped much. I would want to get a 3x1 or 1x3 matrix from block.InputPort(1)
inside my "function Output(block)"

Answers (0)

Categories

Asked:

on 28 Feb 2014

Commented:

on 28 Feb 2014

Community Treasure Hunt

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

Start Hunting!