How to define matrices generated in Stateflow as Fixed size?

조회 수: 9 (최근 30일)
Alex
Alex 2025년 1월 13일
편집: Alex 2025년 1월 16일
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!

답변 (1개)

Githin George
Githin George 2025년 1월 15일
Hi Alex,
I understand that you are facing 2 issues here:
  1. If you specify the corresponding data variables as “variable-size” then the “Matrix Multiply” block is throwing error since it is unsupported case.
  2. 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.
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.
  댓글 수: 1
Alex
Alex 2025년 1월 16일
편집: Alex 2025년 1월 16일
I managed to figure it out. I had to define the slice_A and slice_B matrices before entering the first step as empty matrices with fixed size values. Thanks for your help!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Decision Logic에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by