Main Content


Revert compressed Lookup Table blocks to original versions



revert(compressionResult) reverts the Lookup Table blocks compressed by the FunctionApproximation.compressLookupTables function back to their original state.


replace(compressionResult, index) reverts the lookup tables at the indices specified by index.


collapse all

This example shows how to compress all Lookup Table blocks in a system.

Open the model containing the lookup tables that you want to compress.

system = 'sldemo_fuelsys';

Use the FunctionApproximation.compressLookupTables function to compress all of the lookup tables in the model. The output specifies all blocks that are modified and the memory savings for each.

compressionResult = FunctionApproximation.compressLookupTables(system)
- Found 5 supported lookup tables
- Percent reduction in memory for compressed solution
	-  2.37% for sldemo_fuelsys/fuel_rate_control/airflow_calc/Pumping Constant
	-  2.37% for sldemo_fuelsys/fuel_rate_control/control_logic/Throttle.throttle_estimate/Throttle Estimation
	-  3.55% for sldemo_fuelsys/fuel_rate_control/control_logic/Speed.speed_estimate/Speed Estimation
	-  6.38% for sldemo_fuelsys/fuel_rate_control/control_logic/Pressure.map_estimate/Pressure Estimation
	-  9.38% for sldemo_fuelsys/fuel_rate_control/airflow_calc/Ramp Rate Ki

compressionResult = 

  LUTCompressionResult with properties:

                  MemoryUnits: bytes
             MemoryUsageTable: [5x5 table]
                 NumLUTsFound: 5
              NumImprovements: 5
              TotalMemoryUsed: 6024
           TotalMemoryUsedNew: 5796
           TotalMemorySavings: 228
    TotalMemorySavingsPercent: 3.7849
                          SUD: 'sldemo_fuelsys'
                  WordLengths: [8 16 32]
                  FindOptions: [1x1 Simulink.internal.FindOptions]
                      Display: 1

Use the replace function to replace each Lookup Table block with a block containing the original and compressed version of the lookup table.


You can revert the lookup tables back to their original state using the revert function.


Input Arguments

collapse all

Results of lookup table compression, specified as a LUTCompressionResult object.

Index of the Lookup Table blocks to revert in the system, specified as an integer-valued scalar or vector.

The index of each lookup table corresponds to the ID column in the MemoryUsageTable property of the LUTCompressionResult object.

Data Types: double

Introduced in R2020a