parallel computing for simulink model, which used global variable

7 views (last 30 days)
Hallo all, i wrote a parfor loop, and in the parfor loop a simulink model is called, but this simulink model uses many global variable. And when this model is called, exits a error "Undefined function or variable 'CYCLE'". This CYCLE is a global variable and should be used in Simulink model. Do you have any suggestions? Thanks a lot!
parfor
....
[f_left, con_left, fflag_left] = CallObjFcn(Problem,a,b,calltype,varargin{:});
....
end
function [fcn_value, con_value, feas_flag] = CallObjFcn(Problem,a,b,calltype,varargin)
load('C:Documents\MATLAB\V1Par - Copy\Simulation_Daten');
......
[fcn_value,feas_flag] = feval(Problem.f,point,varargin{:});
......
end
Problem.f = 'gp_con';
function [value,fflag] = gp_con(x)
......
sim('XRSimWWPen01');
......
end

Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!