Simulink setConfig showing error while Updating References for each worker in parallel parfor

5 views (last 30 days)
I am running Simulink Model, which is set to Never Rebuild, in parfor.
Looks like setConfig is showing error with Simulink Model References are being updated.
This is resulting in following error:
Error using Simulink.fileGenControl A build is in progress. During a build the only actions allowed are:
'getConfig'
'get'
Error in Simulink.fileGenControl
Note:
It's required to define CacheFolder & CodeGenFolder for each run although its a same folder.
Code Outline:
% Running first time to create slprj folder
buildFolder = 'C:\Users\Documents\Work\temp';
cfg = Simulink.fileGenControl('getConfig');
cfg.CacheFolder = buildFolder;
cfg.CodeGenFolder = buildFolder;
Simulink.fileGenControl('setConfig', 'config', cfg);
open_system('Simulink_Model')
sim('Simulink_Model')
parfor i=1:3
buildFolder = 'C:\Users\Documents\Work\temp';
cfg = Simulink.fileGenControl('getConfig');
cfg.CacheFolder = buildFolder;
cfg.CodeGenFolder = buildFolder;
Simulink.fileGenControl('setConfig', 'config', cfg);
open_system('Simulink_Model')
sim('Simulink_Model')
end

Answers (0)

Categories

Find more on Deep Learning with Simulink in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!