How to export my simulation data by PostSimFcn, when using parsim function?
이전 댓글 표시
I am using parsim to accelarate my simulations. My maltab is linux 2017b. Codes are shown as
/* for some fp_lst, I declare a Simulink.SimulationInput array */
for i = length(fp_lst):-1:1
inm(i) = Simulink.SimulationInput(mdl);
inm(i) = inm(i).setVariable('index',i);
inm(i).PostSimFcn = @(x) postsim(x);
end
My postsim function is
function newout = postsim(out)
file = (strcat('simdata/out_',num2str(out.index),'.mat'));
save(file,'out'); % in order to save the memory
newout.Ia = out.Ia;
newout.Va = out.Va;
end
Then I call parsim,
out = parsim(inm,'ShowSimulationManager','on','ShowProgress','on');
The program seems to run well but takes forever to terminate. No error message pops out.
Strangely, when I call
out = sim(inm,'ShowSimulationManager','on','ShowProgress','on');
everything is Ok. Moreover, if I comment out the save function in my postsim, everything is still fine.
More Strangely, the code runs well in Windows10.
So my question is how to export my simulation data by PostSimFcn, when using parsim function?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!