How do I change a table lookup algorithm option for all the table lookup blocks in a large Simulink model?

2 visualizaciones (últimos 30 días)
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!

Respuestas (1)

Suman
Suman el 22 de Ag. de 2024
Editada: Suman el 22 de Ag. de 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!

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by