How to access Simulink.LookupTable object from Test Sequence block?

2 次查看(过去 30 天)
I am new to Simulink and I implemented a simulink model that uses 2D look-up tables to interpolate values. I created a test harness for my model and tryed to test the look-up tables. Let us say my lookup table is named LUT in the model explorer work space ( and also defined in the test harness workspace) . I wanted to write in my test sequence editor this command: Bp1= LUT.Breakpoints(1).Value; so that i can access the breakpoints 1 of my lookup table. Of course the test sequence editor does not recognize LUT so i needed to somehow define it. I created in the test sequence editor a parameter named LUT and tryed to run the test. I recieved this error: " expression´LUT´ for initial value of data ´LUT´ must evaluate to logical or supported numeric type". I did not quite understand the error but think the test sequence editor did not recognize that LUT is my lookup table. I do not know how to be able Bp1= LUT.Breakpoints(1).Value without defining LUT correctly. Does anyone have an idea how I can fix this?

回答(1 个)

Samhitha
Samhitha 2025-3-26
Hi @Sou,
To resolve the issue of accessing lookup table breakpoints in your Simulink test sequence, you can try any of these two approaches:
  1. Extract Breakpoints into Simple Variables: Use an initialization script or a model callback (like `InitFcn) to extract the breakpoint values from the lookup table `LUT. For example, assign LUT_Breakpoints1 = LUT.Breakpoints(1).Value; Then, define these extracted values as parameters in the test sequence editor, allowing you to use them directly in your test sequence.
  2. Pass Data via Model Arguments: Configure your model to accept breakpoint values as input arguments by defining model parameters for them. In the test sequence editor, define parameters for these model arguments and initialize them with the breakpoint values. This way, you can access and manipulate the breakpoints within your test sequence without encountering data type or workspace scope issues.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Inputs 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by