Clear Filters
Clear Filters

Why MaximumInd​icesForEac​hDimension must be equal to the number of brake points?

6 views (last 30 days)
Hello,
I am trying to generate C code from a Simulink model (attached) containing a 1-D Lookup Table block where I have selected, in Algorithm tab, "Support tunable table size in code generation" checkbox; I also selected a "Maximum indices for each dimension" parameter equal to 20 (brakepoints array in the data has a length of 11).
Running the code generation (Ctrl+B) I get the following error:
Error:In block 'Variable_Size_LookupTable/1-D Lookup Table', the setting of parameter 'MaximumIndicesForEachDimension' is not valid. It should be a real scalar or vector. The individual value represents the maximum index value of corresponding break point data. As for this block, the correct value for this parameter is '10'.
Now, if the value of "Maximum indices for each dimension" must be equal to the length of brakepoints array, what is the purpose of that parameter?
Is there any way to use 'MaximumIndicesForEachDimension' parameter to set the maximum size of the array longer than the default data used for building?

Answers (1)

Ashutosh Thakur
Ashutosh Thakur on 15 Jul 2024 at 9:25
Hi Francesco,
The error message indicates that the Maximum indices for each dimension parameter value must match the length of the breakpoints array used in the 1-D Lookup Table block. This parameter specifies the maximum allowable size for the breakpoint data array during code generation. It allows the generated code to accommodate different sizes of the breakpoint array, requiring information on the longest possible size for this purpose.
For more information on the 1-D Lookup Table, refer the following documentation link: https://www.mathworks.com/help/simulink/slref/1dlookuptable.html?searchHighlight=%22Maximum%20indices%20for%20each%20dimension%22.
If your breakpoints array has a length of 11, then the value of the Maximum indices for each dimension parameter should be 10, as this follows zero-based indexing. Similarly, if the length of the breakpoints array is 20, then the value of the parameter should be 19.
If you want to use the MaximumIndicesForEachDimension parameter to set a size longer than the default data, you will need to adjust the breakpoints array by padding it to the maximum size defined. This involves adding zeros to the remaining length of the array until the maximum size is reached.
I hope this helps you!

Categories

Find more on Nonlinearity in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!