How to export my simulation data by PostSimFcn, when using parsim function?
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Large Files and Big Data finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!