Hello,
I am developing a custom 2-Level Matlab S-Function for the use in Simulink. I would like to use not a fixed input port dimension, but be able to concatenate signals with a mux block. The resulting signal should then be fed to the 2-Level Function input port, as in the following diagramm.
Unfortunately I stuck at the definitions of the dimensions - if I set the 'DimensionMode' to variable, I get the following error:
Error:Simulink cannot propagate the fixed-size mode from the 'Output Port 1' of 'model/Mux2' to the 'Input Port 1' of 'model/UZ_MonitorInNumeric1'. This input port expects a variable-size mode. Either replace 'model/Mux2' with a block that outputs a variable-size signal or replace 'model/UZ_MonitorInNumeric1' with a block that expects a fixed-size signal.
My definitions in the setup function are:
block.NumInputPorts = 1;
block.NumOutputPorts = 0;
block.SetPreCompInpPortInfoToDynamic;
block.InputPort(1).DimensionsMode = 'Variable';
block.InputPort(1).Dimensions = [1,10];
block.InputPort(1).Complexity = 'Real';
block.InputPort(1).DirectFeedthrough = true;
Is there a way to achieve the desired function within a Matlab 2-Level-S-Function? Thanks in advance!