- If you specify the corresponding data variables as “variable-size” then the “Matrix Multiply” block is throwing error since it is unsupported case.
- If you specify the signals as “fixed-size”, then the Stateflow chart is throwing error mentioning that the variable “slice_B” is inferred to be variable-size matrix.
How to define matrices generated in Stateflow as Fixed size?
18 views (last 30 days)
Show older comments
Hi,
I have had a look around the forum and while there are some similar questions to mine I simply am not understanding where I am going wrong.
Below is my top level design:

with the sub-level looking like this:

the aim for this code is to take two matrices, split them up in to smaller matrices and output complementary slices each time step.
My code works in this sense but trying to use it with further blocks causes this error: "This input port expects a fixed-size mode. The variable-size mode originates from 'controller/Subsystem/Chart'. Examine the configurations of 'controller/Subsystem/Matrix Multiply' for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but needs to be configured for them."
When not setting Slice A or B to variable size I get this error: "'slice_B' is inferred as a variable-size matrix, but its size is specified as inherited or fixed. Verify 'slice_B' is defined in terms of non-tunable parameters, or select the 'Variable Size' check box and specify the upper bounds in the Size box."
What can I do to fix this issue? Thanks in advance!
0 Comments
Answers (1)
Githin George
on 15 Jan 2025 at 11:12
Hi Alex,
I understand that you are facing 2 issues here:
I think your best bet is to focus on the 2nd issue and I suspect that the root cause is assignment of “slice_B” with the slightly complex indexing. I think this is causing to Simulink to resolve/infer “slice_B” to be a variable-size matrix. One way to test this out is to use “for-loops” or “indexed-assignment” into the variable “slice_B” to avoid the complex 2-D indexing with the variables “sBf” and “sBI”.
Also, double check whether your computations are altering the size of “slice_B” since there are many assignment expressions.
If you are facing any issues, provide a reproduction model so that I can give it a try as well.
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!