Persistence in Lookup Table Data

3 ビュー (過去 30 日間)
Jason Nicholson
Jason Nicholson 2018 年 4 月 27 日
回答済み: Jason Nicholson 2018 年 5 月 2 日
I load several large multi-dimensional lookup tables in the initialization of a subsystem that has lookup table blocks. The lookup tables are in a library model. When I build a Simulink model from the library, I will have several instances of the library. This means something like ~10-20 large lookup tables. This really seems to slow down the initialization. When I am interactively running the model, I don't care about the extra time. However, I want to call the big model several thousands times in a loop. The biggest cost is the loading the lookup tables and doing a calculation on the lookup tables to reduce them by 1 dimensions that really only needs done the first time the library runs. Is there a clever way for the data to remain persistent from run to run?
  1. The persistent keyword only works in MATLAB functions. It does not work in Simulink initializations.
  2. I cannot use the base workspace. I cannot guarantee what will be going on the base workspace because I will share my library.

採用された回答

Jason Nicholson
Jason Nicholson 2018 年 5 月 2 日
I found a solution. I posted it to the File Exchange as linked below. The solution is to use UserData of a block to store the data between runs.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by