Profile Matlab System block in Simulink

I have a Simulink model with a Matlab system block in, and would like to understand which code in the block is slowing the simulation down. when I run the profiler I get a breakdown that shows me the System Block is taking most of the time, but it doesn't show me where in the block the slowdown occurs. Is there a way to get such a breakdown similar to what you get when you run the profiler in Matlab? Thanks.

답변 (2개)

Robert Jack
Robert Jack 2023년 6월 15일

1 개 추천

It is possible to use the MATLAB profiler on a Simulink model. Create a script in matlab as follows:-
modelName = 'MyExample';
load_system(modelName)
set_param(modelName,'Profile','on');
open_system(modelName)
sim(modelName);
Then use the standard Matlab profiler to run this script.
Vimal Rathod
Vimal Rathod 2021년 6월 18일
편집: Vimal Rathod 2021년 6월 18일

0 개 추천

Hello,
Like you said, the Simulink profiler would not show MATLAB line-by-line profiling results - rather it will show the time spent on the System block (as a whole).
To understand the performance of individual lines of the System object MATLAB code, we should use the MATLAB profiler as of now there is no other workaround.

카테고리

도움말 센터File Exchange에서 Schedule Model Components에 대해 자세히 알아보기

질문:

2021년 6월 4일

답변:

2023년 6월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by