Why is my variable undefined when using parsim?
Show older comments
I have a simulink model that runs when I'm not running it in parallel, but it will not run in parallel. In the function that invokes my model I create a class handle object and store it in the base workspace. From within the model I have a Matlab function that calls a function of the object by evaluating it in the base workspace. In parallel mode I get an error saying that this object handle is undefined. But it works fine if I don't run it in parallel mode.Â
I've created a simple model that illustrates the problem (you will need to include the files TestClass.m and TestObjSim.slx in the same directory):
objH = TestClass(1);
assignin('base','objH',objH);
% This works:
simOut = sim('TestObjSim');
% Running in parallel doesn't work:
in = Simulink.SimulationInput('TestObjSim');
simout = parsim(in,'TransferBaseWorkspaceVariables','on');
disp(simout.ErrorMessage);
Accepted Answer
More Answers (0)
Categories
Find more on Simulink Functions 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!