Why am I getting a computed maximum size is not bounded error in a MATLAB Function block in Simulink R2021a even when using assert?
I am using a Matlab function in Simulink and want to create arrays whose size varies. However, I can specify the maximum size in advance. I got the following error message, although I am already using the assert function.
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2546.2574), line 86, column 24: "iL_NL_act:1:(iL_NL_act_plLL)" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2602.2630), line 87, column 24: "iR_NL_act:1:(iR_NL_act_plLL)" Launch diagnostic report.
Here is the corresponding code:
LL = 7;
assert (varyingInput_a <= 800)
assert (varyingInput_b <= 800)
varyingInput_a_plusLL = varyingInput_a+LL;
varyingInput_b_plusLL = varyingInput_b+LL;
assert (varyingInput_a_plusLL <= 800)
assert (varyingInput_b_plusLL <= 800)
iLrange_act(1:LL+1) = (varyingInput_a:1:(varyingInput_a_plusLL))-m;
iRrange_act(1:LL+1) = (varyingInput_b:1:(varyingInput_b_plusLL))-m;
I had the same problem before in the same Matlab function for an input variable from which the variables used here are calculated. There I also used the assert function and the error no longer occurred. I would have expected that using the function once before using the variable for the first time would be enough to limit all other variables derived/calculated from it.
Here is the code from the first assert use:
assert (N_act <= 800)
Angel4Nact = [1:1:N_act]*(2*pi/N_act);
varyingInput_a and varyingInput_b are calculated using N_actI am using a Matlab function in Simulink and want to create arrays whose size varies. However, I can specify the maximum size in advance. I got the following error message, although I am already using the assert function.
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2546.2574), line 86, column 24: "iL_NL_act:1:(iL_NL_act_plLL)" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2602.2630), line 87, column 24: "iR_NL_act:1:(iR_NL_act_plLL)" Launch diagnostic report.
Here is the corresponding code:
LL = 7;
assert (varyingInput_a <= 800)
assert (varyingInput_b <= 800)
varyingInput_a_plusLL = varyingInput_a+LL;
varyingInput_b_plusLL = varyingInput_b+LL;
assert (varyingInput_a_plusLL <= 800)
assert (varyingInput_b_plusLL <= 800)
iLrange_act(1:LL+1) = (varyingInput_a:1:(varyingInput_a_plusLL))-m;
iRrange_act(1:LL+1) = (varyingInput_b:1:(varyingInput_b_plusLL))-m;
I had the same problem before in the same Matlab function for an input variable from which the variables used here are calculated. There I also used the assert function and the error no longer occurred. I would have expected that using the function once before using the variable for the first time would be enough to limit all other variables derived/calculated from it.
Here is the code from the first assert use:
assert (N_act <= 800)
Angel4Nact = [1:1:N_act]*(2*pi/N_act);
varyingInput_a and varyingInput_b are calculated using N_act I am using a Matlab function in Simulink and want to create arrays whose size varies. However, I can specify the maximum size in advance. I got the following error message, although I am already using the assert function.
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2546.2574), line 86, column 24: "iL_NL_act:1:(iL_NL_act_plLL)" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2602.2630), line 87, column 24: "iR_NL_act:1:(iR_NL_act_plLL)" Launch diagnostic report.
Here is the corresponding code:
LL = 7;
assert (varyingInput_a <= 800)
assert (varyingInput_b <= 800)
varyingInput_a_plusLL = varyingInput_a+LL;
varyingInput_b_plusLL = varyingInput_b+LL;
assert (varyingInput_a_plusLL <= 800)
assert (varyingInput_b_plusLL <= 800)
iLrange_act(1:LL+1) = (varyingInput_a:1:(varyingInput_a_plusLL))-m;
iRrange_act(1:LL+1) = (varyingInput_b:1:(varyingInput_b_plusLL))-m;
I had the same problem before in the same Matlab function for an input variable from which the variables used here are calculated. There I also used the assert function and the error no longer occurred. I would have expected that using the function once before using the variable for the first time would be enough to limit all other variables derived/calculated from it.
Here is the code from the first assert use:
assert (N_act <= 800)
Angel4Nact = [1:1:N_act]*(2*pi/N_act);
varyingInput_a and varyingInput_b are calculated using N_act simulink, matlab function, coder error, size not bounded, assert, 2021a MATLAB Answers — New Questions