how to run simulink simulation from matlab script
Ältere Kommentare anzeigen
hello i need to run simulink simulation from matlab, how to do it using matlab command in script ?
1 Kommentar
Guy Rouleau
am 22 Jul. 2024
Here is a blog post on this topic: How to Run Simulink Simulation from MATLAB Script? » Guy on Simulink - MATLAB & Simulink (mathworks.com)
Akzeptierte Antwort
Weitere Antworten (3)
Reid Spence
am 22 Jan. 2024
Bearbeitet: Reid Spence
am 22 Jan. 2024
simIn = Simulink.SimulationInput("Model_Name"); %create object
simIn = simIn.setVariable("my_Parameter",2); %example of setting a parameter override
out = sim(simIn); %run simulation, all results returned in "out"
The benifits of using the SimulationInput object over using ">sim("model_name")" include:
- ability to override parameters and settings without dirtying the model
- a helpful container for all run specific overrides
- easier transitions to other workflows such as parallel simulation with parsim or deployment with Simulink Compiler
Guy Rouleau
am 9 Jul. 2024
2 Stimmen
I wrote a blog post on this topic:
This documentation page also covers this topic in great details:
marcus sick
am 13 Mär. 2024
0 Stimmen
A recommended approach for executing simulations in MATLAB involves leveraging the SimulationInput object.
simIn = Simulink.SimulationInput("Model_Name i.e (YT3converter)"); % Create object simIn = simIn.setVariable("my_Parameter", 2); % Example of setting a parameter override out = sim(simIn); % Run simulation; all results are returned in "out"
The advantages of utilizing the SimulationInput object over the conventional method ">sim("model_name")" are manifold:
- It enables parameter and setting overrides without modifying the model directly, ensuring model cleanliness and preserving its integrity.
- Serving as a convenient container, it organizes all simulation-specific overrides, enhancing clarity and manageability.
- Facilitates seamless transitions to alternative workflows like parallel simulation with parsim or deployment via Simulink Compiler, thus fostering versatility and adaptability in simulation practices.
Kategorien
Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!