Is it possible to define the output dimension of a Simulink Subsystem within the corresponding Mask?

3 views (last 30 days)
Hello everyone,
I want to realize a Simulink Subsystem that has output dimensions which are defined within a Mask. Therefore I placed a Constant-block into a Subsystem, which can be edited within the Subsystem-Mask (by promotion the value). The output from the Constant-Block is then provided to a MALTLAB function with the following code (as example):
function y = fcn( dim )
%#codegen
y = ones( dim );
This output represents the output of the Subsystem.
Now, I would like to enter [2 3] into the Mask and get an 2x3 matrix as output. The dimensions of the output are not changed during a simulation. However, the dimensions should not be restricted to 2.
Until now I couldn't get it to run. I tried to use a variable output signal, however I'm not sure if that's the right approach since my signal doesn't change during one simulation. Then, I tried the InitFct-Callback, but I have problems to define the output dimensions within this callback since I cannot manage to get access to the entered values within the mask.
It would be helpful if someone could show me how to solve this problem or point me to the corresponding information I need.
Thank you.
Best regards Christian
  1 Comment
Torsten Knodt
Torsten Knodt on 10 Nov 2014
Did I understand right, that in total you need a constant outputting a matrix of ones with mask parametrizable dimensions? If yes, just enter ones(dimensions) as the value of a constant and mask it with the only non-tunable parameter dimensions.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!