How do I change a table lookup algorithm option for all the table lookup blocks in a large Simulink model?
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Suman
on 22 Aug 2024
Edited: Suman
on 22 Aug 2024
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 Comments
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!