View Lookup Table Data
You can use a lookup table viewer to view lookup table and breakpoint data. The lookup
table view is shared by multiple , including the
property dialog box and the lookup table control. This topic and its examples are
presented using the
Simulink.LookupTable property dialog box. Here is
lookup table data as soon through the
When the Breakpoints specification property is set to
Explicit values, use the tabular interface and
MATLAB® expression text box at the bottom of the viewer to:
View, add, manipulate, and remove table and breakpoint data.
Create or modify table or breakpoint data using MATLAB expressions.
View and edit 2-D slices of data from multiple dimensions.
This topic describes:
Supported data types for the viewer tabular Interface
How to create, edit, and view table and breakpoint data in the tabular interface
How to view multidimensional 2-D slices
How the tabular interface handles data overflows
How the tabular interface handles invalid data
Supported keyboard shortcuts
Lookup Table Viewer Data Type Support
The viewer supports these data types:
Built-in data types (
Fixed-point data types
It does not support other data types that Simulink® supports.
To start working with a
Simulink.LookupTable object, create one at
the MATLAB command line:
LUTObj = Simulink.LookupTable;
How to Open the
Simulink.LookupTable Object Property Dialog Box
To work with the
Simulink.LookupTable object, start its property
dialog box in one of these ways from the MATLAB Command Window:
In the workspace, double-click the
In the Model Explorer, double-click the object in the specific workspace for the object.
In the command line, use the
openfunction, for example:
Create Table and Breakpoint Data
Generate data and manipulate it using standard table editing actions. You can generate lookup table data in multiple ways, such as in the workspace, from Microsoft® Excel®, and so forth, and copy that data into the tabular area. You can also generate data from within the property dialog box using MATLAB expressions.
This example describes how to create data in the MATLAB Command Window workspace and how to set up the property dialog box using an example with that data.
To create table and breakpoint data, at the MATLAB command line, type:
LUTObj.Breakpoints(1).Value = fi(linspace(1000,5000,5),1,16,2); LUTObj.Breakpoints(2).Value = single(linspace(1,2,5)); LUTObj.Table.Value = uint16(rand(5,5)*60*60);
Set up the Unit and Field name properties for the object.
LUTObj.Breakpoints(1).Unit = 'rpm'; LUTObj.Breakpoints(2).Unit = 'Nm'; LUTObj.Table.Unit = 'kg/hr'; LUTObj.Breakpoints(1).FieldName = 'Corr_Speed'; LUTObj.Breakpoints(2).FieldName = 'Prs_ratio'; LUTObj.Table.FieldName = 'Mass_Flow_Rate';
Open the property dialog box.
From within the tabular area, you can perform typical table edits on particular breakpoint data, such as copying and pasting. When you are done, click Apply.
View Multidimensional Slices of Data
The viewer lets you view and edit 2-D slices of data. This example describes how to use the slice selector to navigate through the 2-D slices of 3-D data.
To view a multidimensional slice, use the dropdown lists under the MATLAB expression parameter. There is a dropdown list for each breakpoint. To view a two-dimensional slice, choose a combination of the breakpoint data from the vertical and horizontal dropdown lists.
Change the table dimensions to
In the tabular area at the bottom, change the horizontal breakpoint slice to
BP3. Observe the changed view of the slice of data.
Edit Table and Breakpoint Data with MATLAB Expressions
Edit table and breakpoint data using standard table editing actions, such as cutting or copying and pasting, or directly editing table cells. You can also edit table and breakpoint data with MATLAB expressions.
This example shows how to replace the table and breakpoint using a MATLAB expression.
In the viewer dialog box, in the tabular area at the bottom, select BP3 from the horizontal dimension dropdown list.
In the MATLAB expression field, enter
Observe the changed view of the slice of data.
Edit Table and Breakpoint Data
You can perform standard table edits in the viewer. This example shows how to apply the same value to multiple cells.
Replace a column of data with the same value.
In the viewer tabular area, select row 1, column 2 of the table data.
Select the entire column by dragging down the column.
Observe that the entire column of data is now
Add a row to the table.
In the viewer tabular area, right-click the last row of the table and select Insert > Insert Row Below.
Delete a column in the table.
In the viewer tabular area, right-click the last column of the table and select Delete > Delete Column.
Select and paste a region in the table.
In the viewer tabular area, select the top-left cell of your selection and drag to the bottom-right of your selection.
Copy the selected area with Ctrl+C.
Select another area of the table. Paste the selected data with Ctrl+V.
Enable Heatmap for Table Data
You can view heatmaps for your data. Right-click any cell in the table and select Heatmap On.
Simulink.LookupTable object property dialog box handles
data overflows in the tabular area by automatically changing values to ones that do
not cause overflows. For example, if you enter a value of
in a cell for a data type of
uint16, the property dialog box
automatically changes the value to
65535, which is the maximum
uint16. For a list of supported
Simulink.LookupTable object property dialog box data types,
see Lookup Table Viewer Data Type Support.
The lookup table viewer performs data validation when you enter a table cell value and press Enter. For example, if you enter
-Inf as a table cell value, an error is displayed.
The MATLAB expression area also validates expressions. For example, if you enter an invalid expression, the text box is outlined in red and displays an error message on an expected expression. If you enter an expression for fixed-point data with a bias, the software evaluates and, as necessary, saturates the value to the nearest available fixed-point value before displaying the corrected value in the table.
Lookup Table Viewer Tabular Interface Shortcuts
|Action||Key or Keys|
Move to the table cell above current active cell.
Move to table cell under current active cell.
Move to the table cell to the right of the current active cell.
Right Arrow or Tab
Move to the table cell to the left side of current active cell.
Left Arrow or Tab+Shift
Move to the first table cell in a row.
Move to the last table cell in a row.
Move to the first table cell in a column.
Move to the last table cell in a column.
|Action||Key or Keys|
Extend selection of the table cell above.
Extend selection of the table cell underneath.
Extend selection of the table cell to the right.
Extend selection of the table cell to the left.
Select all table cells in the row to the left, including the current cell.
Select all table cells in the row to the right, including the current cell.
Select all cells from the column to the top of the table, including the current cell.
Select all cells from the column to the bottom of the table, including the current cell.
|Action||Key or Keys|
|Open or close table cell editor.||Enter|
|Open table cell editor.||F2|
|Cancel editing and close table cell editor.||Esc|
|Clear table cell.||Backspace or Delete|
|Copy table cell content.||Ctrl+C|
|Cut table cell content.||Ctrl+X|
|Paste table cell content.||Ctrl+V|
|Fill all selected table cells with edited cell value.||Ctrl+Enter|
Context Menu Navigation
|Action||Key or Keys|
Move the selection to the next option in context menu.
Move the selection to the previous option in context menu.
Select option from context menu.