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

1 次查看(过去 30 天)
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:

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by