- In the relevant "Subsystem Reference" block, create a mask with a dialog parameter with the name "<variable>" by following the steps in the documentation page Create a Simple Mask.
- Right click on the "Subsystem Reference" block and select "Properties" in the drop-down menu.
- Navigate to the "Callbacks" tab and select the "StartFcn" option in the callback list.
- In the code area, enter the following code:Where <dimension> is an integer with a value of 1 greater than the dimension requested of the input signal. The first element of "CompiledPortDimensions" is the always the size of the resulting array.portHandles = get_param(gcb, ‘PortHandles’);portDims = get_param(portHandles.Inport, ‘CompiledPortDimensions’);set_param(gcb, ‘<variable>’, num2str(portDims(<dimension>)));
How can I use a subsystem reference mask to find the dimensions of an input signal in Simulink R2024a?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 16 Set 2025
Risposto: MathWorks Support Team
il 24 Ott 2025 alle 13:27
In my Simulink R2024a model, I have a "Subsystem Reference" block that accepts an input signal. I would like to use the mask parameters on this block to find the dimensions of the input signal, instead of using extra blocks such as a "Width" block. How can I achieve this workflow?
Risposta accettata
MathWorks Support Team
il 16 Set 2025
As of MATLAB R2024a, this workflow is not supported. To find the dimensions of a port signal, you may use the "CompiledPortDimensions" block parameter. However, since masks are evaluated during model compilation, this block parameter will not be available upon calling "get_param". Please refer to the documentation page Determine Signal Dimensions for more information about "CompiledPortDimensions".
As a workaround, you can use the "StartFcn" block callback instead of a mask, which runs after a model is compiled and before it starts running. To do so, please follow these steps:
For more information about the "StartFcn" callback and block parameters, please refer to the documentation pages Block Callbacks and Set Block Parameter Values, respectively.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Subsystems in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!