Generate ST code from a look-up table with CONSTANT attribute
Hi,
I am using the ‘Direct Lookup Table (n-D)’ block in Simulink to load a matrix and extract the values given a row and a column number as inputs.
The Simulink setup is shown in the attached figure "lookup-table.png".
With this setup a PLC function block in structured text is generated from MATLAB/Simulink and everything is working as expected. However, the look-up table is defined within the function block as "VAR". I would like, if possible, to define it as "VAR_CONSTANT" instead. I have tried setting the in the lookup table attribute "StorageClass" type to "Const" but that has not worked.
Any idea/suggestion on how to store this table as "VAR_CONSTANT"?
Thanks in advance.Hi,
I am using the ‘Direct Lookup Table (n-D)’ block in Simulink to load a matrix and extract the values given a row and a column number as inputs.
The Simulink setup is shown in the attached figure "lookup-table.png".
With this setup a PLC function block in structured text is generated from MATLAB/Simulink and everything is working as expected. However, the look-up table is defined within the function block as "VAR". I would like, if possible, to define it as "VAR_CONSTANT" instead. I have tried setting the in the lookup table attribute "StorageClass" type to "Const" but that has not worked.
Any idea/suggestion on how to store this table as "VAR_CONSTANT"?
Thanks in advance. Hi,
I am using the ‘Direct Lookup Table (n-D)’ block in Simulink to load a matrix and extract the values given a row and a column number as inputs.
The Simulink setup is shown in the attached figure "lookup-table.png".
With this setup a PLC function block in structured text is generated from MATLAB/Simulink and everything is working as expected. However, the look-up table is defined within the function block as "VAR". I would like, if possible, to define it as "VAR_CONSTANT" instead. I have tried setting the in the lookup table attribute "StorageClass" type to "Const" but that has not worked.
Any idea/suggestion on how to store this table as "VAR_CONSTANT"?
Thanks in advance. plc coder, structured text MATLAB Answers — New Questions