How can I get the execution order of blocks in a Simulink model by means of a MATLAB script?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dark_Knight
el 28 de Ag. de 2023
Respondida: Jerbin J
el 15 de Sept. de 2023
I am in need of getting the order of execution of each blocks in a Simulink model.Help me with this.
1 comentario
Ramtej
el 28 de Ag. de 2023
Hi
Refer to https://in.mathworks.com/help/rptgenext/ug/report-execution-order-of-tasks-and-blocks-in-a-simulink-system.html for detailed instructions on how to generate report on Execution Order of Tasks and Blocks in Simulink Systems
Respuesta aceptada
Jerbin J
el 15 de Sept. de 2023
% Get model name
modelName = bdroot(gcs);
% Empty array for execution order
executionOrder = [];
% Turn off data logging
mdlsignals = find_system(gcs,'FindAll','on','LookUnderMasks','all','FollowLinks','on','type','line','SegmentType','trunk');
portHandle = get_param(mdlsignals,'SrcPortHandle');
for i=1: length(portHandle)
set_param(portHandle{i},'datalogging','off')
end
% Get blocks by execution order
sortedList = get_param(modelName, 'SortedList');
%% Logic
for ii = 1:length(sortedList)
handl = sortedList(ii);
% Get block name
blkName = string(get_param(handl,'Name'));
% Get block type
blkType = get_param(handl,'BlockType');
% Check if block is "Constant"
if strcmp(blkType,'Constant') == 0
% Form the array
executionOrder = [executionOrder;blkName];
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Block Libraries en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!