MATLAB closes very slowly after running S-Function

15 views (last 30 days)
Hello everyone,
I recently started using a Simulink to model wind turbines. The turbine model is contained by an S Function, and I noticed, that everytime I run a Simulink model containing this S Function, MATLAB closes much more slowly.
Did anybody experience such an issue before? Or do you have any suggestions that I could try? I'm happy to answer any further questions that might help.
Best regards

Answers (1)

Hornett
Hornett on 9 Oct 2023
I understand you're experiencing with MATLAB closing slowly when running a Simulink model containing an S Function, there could be a few potential reasons for this behavior. Here are some suggestions to help diagnose and address the issue:
  1. Check for Memory Usage: Large models or complex S Functions can consume a significant amount of memory during simulation. Check your system's memory usage while running the Simulink model to see if it's reaching its limits. If memory usage is high, consider optimizing your model or S Function to reduce memory requirements.
  2. Review S Function Code: Examine the code inside your S Function to ensure it's efficient and doesn't contain any unnecessary computations or memory-intensive operations. Make sure you're using appropriate data types and minimizing memory usage within the S Function code.
  3. Update MATLAB and Simulink: Ensure that you're using the latest version of MATLAB and Simulink. MathWorks frequently releases updates that include bug fixes and performance improvements. Updating to the latest version may help resolve the slow closing issue.
It's worth noting that diagnosing performance-related issues can be complex and may require further investigation. Providing more details about your Simulink model, S Function, and any error messages or warnings you encounter could help in identifying the root cause of the slow closing issue.
I hope this information helped you .

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!