Simulink variant subsystem accepting multiple input dimensions

2 views (last 30 days)
I have a question regarding variant model. I created a 'subsystem' in the form of a variant model that represents a certain part of my physical system. Within this variant model is only a Matlab function block that is coded such that it is able to accept inputs of various sizes (both scalars and arrays) and outputs are automatically adjusted to be of the same size.
However, once i start compilation of the main model, the variant model infers all signals to be scalars. Therefore the functions inside do not work anymore. I was wondering how i should specify the port dimensions such that it accepts multiple sizes of inputs. I understand that the compiler needs information about the maximum size of the arrays.
I can specify the maximum sizes and check the 'variable size' box. But then once I try to run a model which doesn't input arrays of this maximum size then the model returns an error.
Error using modelfunctioncaller (line 30)
Error in port widths or dimensions. Output port 1 of
'Test_block/Mux' is a one dimensional vector with 2 elements.
Error using modelfunctioncaller (line 30)
Error in port widths or dimensions. Input port 1 of
'Test_block/Model1' is a one dimensional vector with 4 elements.
How should i specify the sizes in the Matlab function block, within the variant model, such that it is able to accept multiple sizes?
Kind regards,
Robbin
  1 Comment
Vineeth Kartha
Vineeth Kartha on 17 Mar 2016
Hi,
Will it be possible for you to share the model so that everyone gets a better understanding of what your MATLAB code does.
Regards
Vineeth

Sign in to comment.

Answers (0)

Categories

Find more on Component-Based Modeling in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!