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!