How to solve this issue?

조회 수: 1 (최근 30일)
Nisar Ahmed
Nisar Ahmed 2022년 9월 8일
답변: Jeffrey Clark 2022년 10월 2일
Hi,
I have 100 initial models say length of 115 each, and after running simulation I created 100 new models. I am running simulation mannually e.g., for 1 model, then for model 2, model 3 and so on. and each time I save simulated result. If I save each time as a .mat file, it will be 100 mat file. then to plot all hundred .mat files together will be a bit hectic.
Is there a way if I run manually and results are saving automatically in one file?

답변 (1개)

Jeffrey Clark
Jeffrey Clark 2022년 10월 2일
@Nisar Ahmed, I think what you want to do to have Simulink outputs grouped across multiple runs is something like the example in Run Simulations Programmatically - MATLAB & Simulink (mathworks.com) and the example repeated here where all the outputs from each sim run are collected together in an array of Simulink.SimulationOutput. The loop here could instead not be a loop and just a bunch of manually entered simOut(run) = sim(__) calls after setting your run-to-run model changes:
N = 100;
simOut = repmat(Simulink.SimulationOutput, N, 1);
for i = 1:N
simOut(i) = sim('vdp', 'timeout', 1000);
end

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by