How to save Simulink Simulation output and runs it sequentially (creating a database)?

1 view (last 30 days)
Hi everyone!
I have a Simulink Simulation that has two blocks To Workspace, exporting two variables: Ir and Fault. How can I create a script that calls my simulink simulation and save these outputs sequentially, like Ir1, Ir2, Fault1, Fault2 and so on.
I tried:
function save = postsim(out);
for i=1:2
Save('Ir','Fault');
end
end
and:
in = Simulink.SimulationInput('MyModelName');
in = in.setPostSimFcn(@(Fault) save(Fault));
in = in.setPostSimFcn(@(Ir) save(Ir));
in = in.setModelParameter('SaveOutput','on');
out = sim(in);
And I get:

Answers (0)

Categories

Find more on Simulink 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!