How do I change a table lookup algorithm option for all the table lookup blocks in a large Simulink model?
2 ビュー (過去 30 日間)
古いコメントを表示
I recently ran the Model Advisor on a Simulink model and allowed it to change the settings on all my table lookup blocks. The Advisor suggested checking the "Begin index search using previous index result" to improve performance. However, this option causes my auto-coded model to crash at startup. Now I need to "uncheck" this algorithm option for all my table lookup blocks. Since this is a large model with probably 100 or more table lookups, I need a shortcut!
0 件のコメント
回答 (1 件)
Suman
2024 年 8 月 22 日
編集済み: Suman
2024 年 8 月 22 日
Hi Jeff,
You can do it programaticaly with a simple MATLAB script.
1. Get all the Lookup Table blocks present in the model:
lookupBlocks = find_system(modelName, 'FollowLinks', 'on', 'LookUnderMasks', 'all', ...
'BlockType', 'Lookup_n-D');
2. Now loop over all the blocks and "check" or "uncheck" the "Begin index search using previous index result" options as needed:
for i = 1:length(lookupBlocks)
block = lookupBlocks{i};
try
set_param(block, 'BeginIndexSearchUsingPreviousIndexResult', false);
catch ME
% In case this parameter does not exist
warning('warning msg: %s', ME.message);
end
In general if you want to set some parameter value for any entity in your model, you can use the above approch. To find the "tag" for that parameter, you can use the following command:
get_param(entity_handle, 'ObjectParameters')
%or
get_param(entity_handle, 'DialogParameters')
I hope that helps!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!