How can I use a parfor loop in matlab for a simulink simulation using structs?
조회 수: 6 (최근 30일)
이전 댓글 표시
Hello,
I have a simulink model with different outputs (to workspace - matrix) and one input x (factor) that I want to run in a parfor loop. The simulation takes hours so I wanted to use parallel computing, storing the results in structs (or what else would be possible?). I always get the message 'syntax error' - (its working as a normal for loop) who can show me the problem? thanks! marcus
tic
matlabpool open 8
factor= 1:10;
parfor counter= 1:10
x = factor(counter);
sim('M_Campusnetz_working_modell');
counter.(['Durchlauf_' num2str(counter)]).Voltage= simout_NVP_Voltage;
counter.(['Durchlauf_' num2str(counter)]).Current= simout_NVP_Current;
end
matlabpool close
toc
댓글 수: 0
답변 (1개)
Edric Ellis
2013년 12월 10일
There's lots of information about using Simulink inside PARFOR here. I think you need to use the single-output-argument form of the SIM command.
댓글 수: 2
Kaustubha Govind
2013년 12월 18일
Is the 'frequency' value for the powergui block or any source block in your model set to a workspace variable?
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulation and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!