Why is my variable undefined when using parsim?
이전 댓글 표시
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);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!