How can I communicate the progress of a long simulation?

R
Remingtonsmith · Sep 18, 2020 · 2.2K views
Question
I have a simulation that might take hours or days to complete. How can I update the user of the progress of this simulation without degrading simulation performance?
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 24, 2026

This can be done using the following function set in the InitFcn Callback:

end_time=str2double(get_param(gcs,'stoptime'));

Then an approprately sampled clock source block can be connected to a gain block that references the END_TIME variable that is initialized by the InitFcn callback. This will compute the percent complete value that can be displayed in the MATLAB command window using an s-function of an embedded MATLAB function. A display block would also be useful for this purpose.

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!