Looking for an efficient way to run Simulink on thousands of independent files
Show older comments
I'm running Simulink using some rather complex in-house code, so my ability to modify it extensively is limited, but I can modify it. The structure is as below, and I'm looking for a better/faster way to run through it:
- I have a folder that contains 5000 data files, all completely independent from each other: run1.mat, run2.mat, etc. These are all time-based systems.
- The in-house code loads up one of these mat files, loops through a range of specified time points (10s, 20s, 30s, etc) and at each time point pulls data from this mat file, updates a large number of variables located in the base workspace, then recompiles the Simulink model before finally storing the output data.
To "parallelize" this, this code also has the ability to kick off other matlab sessions within itself, giving each session a different range of run numbers to evaluate. This works but has a lot of overhead, eventually running entirely out of memory when doing too many. I do have access to an HPC and would like to utilize it where possible.
My question is if I can utilize any of the Simulink parallelization capabilities to fit my situation? Considering Simulink pulls from the base-level workspace variables and my tool can update them from anywhere within its 30 script collection, it's not exactly feasible to just do some updates in a parfor loop and do it that way. At least I don't think.
Thanks
1 Comment
dpb
on 9 Aug 2025
It would seem you would have to have a way to create independent copies of the necessary data contained in the workspace in order to be able to distribute it.
Accepted Answer
More Answers (0)
Categories
Find more on String 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!