MATLAB: How to enter the table data for a 3D Lookup-Table in Simulink 6.6 (R2007a)

datainputssimulinktabletabledata

I want to specify the table data for a 3D Lookup Table, but this seems not to be as easy as for a 2D Lookup Table where you can just enter something like:
[1 2 3 4; 5 6 7 8; 9 10 11 12]

Best Answer

There are different ways to specify the table data for a 3D Lookup Table block in Simulink 6.6 (R2007a). The following steps show how to create a [3x4x2] table data matrix:
1) Create a workspace variable and reference this in the Table Data field of the block mask
mydata(:,:,1) = [1 2 3 4; 5 6 7 8; 9 10 11 12];
mydata(:,:,2) = [13 14 15 16; 17 18 19 20; 21 22 23 24];
and then reference to
mydata
2) Use the CAT function to create the matrix in just one row:
cat(3, [1 2; 3 4], [5 6; 7 8]);
3) Use the RESHAPE function to create the matrix in just one row:
reshape([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24],3,4,2);
4) Launch the Lookup Table Editor from the "Tools" menu in your Simulink model and create the table data.
In general you can take very similar steps to enter the table data for a n-D Lookup Table block.