Signal dimensions propagation to submodels

4 次查看(过去 30 天)
Hi, all!
I am trying to creare a submodel in simulink. In the submodel, there is one input port and one output port, and some image processing blocks inbetween. To encorporate submodel i use 'model' block (standard). The top-level model loads an image and passes it to the submodel. I have a problem, that image dimensions are determined for image loading block on during the compilation time (the load image block is implemented as Level-2 MATLAB function, path to the image is a parameter, in the setup() function image information is read and the dimensions of the output port are set based on this information), but for submodel the input port dimensions are somehow set to 1, although port dimenstions property for input port is set to inherit.
Why is it happening? Does anybody know the way to fix this?
Best regards, Alina

回答(1 个)

Kaustubha Govind
Kaustubha Govind 2012-6-18
AFAIK, referenced models cannot inherit signal dimensions - if specified as Inherited (-1) on the port, by default it is assumed that the input is a scalar variable. This is done because the referenced model is compiled independently of the parent, so you must specify the input/output size, datatype and complexity. It looks like the sample time however can be inherited under some conditions.
In your case, since the referenced systems input size changes depending on a parameter in the parent, it might be better to copy the other model in as a subsystem instead of a referenced model.

产品

Community Treasure Hunt

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

Start Hunting!

Translated by