Clear Filters
Clear Filters

2-D lookup table error

25 views (last 30 days)
Kaiser Ahmed Bhuiyan
Kaiser Ahmed Bhuiyan on 18 Feb 2023
Answered: Shubham on 10 Mar 2023
I am trying to feed a matlab lookup table object (file name= Cp) to a 2-D lookup table block. The file format is ok, but when i select it , a message pops up every time- "
  • Variable Cp referenced by block 'Assignment1/Subsystem/2-D Lookup Table' does not resolve to a valid Simulink.LookupTable object.
The table i am trying to load shows as a "Struct" in matlab workspace. What i can i do to solve this issue ? I am really stuck here.
  1 Comment
Walter Roberson
Walter Roberson on 19 Feb 2023
What is a "matlab lookup table object" ? Simulink defines lookup table objects, but I do not recall seeing any such object in MATLAB itself ? I especially do not remember any such object being represented as a struct.

Sign in to comment.

Answers (1)

Shubham
Shubham on 10 Mar 2023
Hi Kaiser,
The error message suggests that the variable "Cp" that you are referencing in your 2-D Lookup Table block is not a valid Simulink.LookupTable object. This could happen if the variable "Cp" is not loaded properly in your Simulink model or if it is not a compatible data type for the 2-D Lookup Table block.
To resolve this issue, here are some steps you can try:
  1. Ensure that the variable "Cp" is loaded properly in your Simulink model. You can do this by checking the workspace browser in Simulink and confirming that the variable "Cp" is present and has the correct data type.
  2. Check the format of the file that you are using to load the lookup table. The file should be in a compatible format for the 2-D Lookup Table block. You can refer to the documentation for the 2-D Lookup Table block to see the supported file formats.
  3. If the file format is correct, try converting the "Cp" variable to a Simulink.LookupTable object using the "lut" function in MATLAB. Here is an example code snippet:
Cp_lut = lut(Cp.x, Cp.y, Cp.z);
This will convert the "Cp" variable to a Simulink.LookupTable object called “Cp_lut". You can then use this object in your 2-D Lookup Table block.
If none of the above steps work, you can try creating a new Simulink.LookupTable object in Simulink and manually entering the data from your "Cp” table. To do this, you can right-click on the 2-D Lookup Table block and select "Edit Data". Then, enter the data points from your "Cp" table in the appropriate fields.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!