How to make use of custom storage classes for Look up tables?

조회 수: 3 (최근 30일)
How to make use of custom storage classes for Look up tables?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2019년 2월 27일
Firstly,
Create an LUT Object as per the link: https://www.mathworks.com/help/simulink/slref/simulink.lookuptable-class.html
>> LUTObj = Simulink.LookupTable;
>> LUTObj.Table.Value = [1.1 2.2 3.3 4.4 5.5];
>> LUTObj.Breakpoints(1).Value = [-2 -1 0 1 2];
>> LUTObj.StructTypeInfo.Name = 'myLUTStruct';
The above creates an Look-Up Table object in the base workspace. You can double click on it from the workspace in order to update the Storage Class.
Then, in the model attached there is a Look-up table.
In the block parameters, under Data Specification specify the "Look-up Table object" the name as "LUTObj" created previously and then update the model (Ctrl+D).
Once this is done, you can navigate to the Model Data Editor-> Parameters-> Code tab and then make changes to the Storage Class of the Look-up table object.
You can select the storage class based on your requirements. Once you do that, you can generate code for the same and note the changes in how the Look up Table object is reflected in the code.
To understand the different storage classes available, review the links below:
1) https://www.mathworks.com/help/rtw/ug/choose-a-built-in-storage-class-for-controlling-data-representation-in-the-generated-code.html
2) https://www.mathworks.com/help/rtw/ug/how-generated-code-stores-internal-signal-state-and-parameter-data.html
3) https://www.mathworks.com/help/ecoder/examples/configure-data-interface-by-applying-custom-storage-classes.html
See the attached files for an example of using the Simulink.LookupTable object with the Struct custom storage class.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by