필터 지우기
필터 지우기

How can I load mat data in 'parsim' local workers ?

조회 수: 2 (최근 30일)
Roberto Tascioni
Roberto Tascioni 2022년 1월 19일
댓글: Rahul Kumar 2022년 4월 8일
Hi, all, I'm not an expert on parallel simulations so I explain here my problem:
I created a simulink project, it runs without problems, inside it there are many matlab user defined functions with "load" who takes data from the workspace previously generated using a preload function (command line in simulink executed before the simlation starts).
I'm trying to replicate it using the Parsim tool of matlab, but I get an error since the workers are still using another path and the preload is uneffective. How can I workaround this issue ? I put here also a possible solution, but I cannot apply it in my case without a pragmatic example.
thanks !
here is my code:
Geo_sweep = [1 2 3]; % three locations
numSims = length(Geo_sweep);
mdl1 = 'system_270621Hybrid6';
% open_system(mdl1)
for i = numSims:-1:1
in(i) = Simulink.SimulationInput(mdl1);
in(i) = setBlockParameter(in(i), [mdl1 '/wheather_sun data'], 'GeoSelector', num2str(Geo_sweep(i)));
end
%start parallel simulation
% setupFcn = @()addpath(pwd);
poolobj = parpool('local',3);
addAttachedFiles(poolobj,{'tutto.mat'});
setupFcn = @()evalin('base','load tutto.mat' );
% out_Hybrid = parsim(in,'ShowSimulationManager', 'on','ShowProgress','on','TransferBaseWorkspaceVariables','on','SetupFcn',setupFcn)
out_Hybrid = parsim(in,'ShowSimulationManager', 'on','ShowProgress','on','SetupFcn',setupFcn)
  댓글 수: 1
Rahul Kumar
Rahul Kumar 2022년 4월 8일
Can you provide some more details? Is the setupFcn throwing an error? It would be good to paste the exact text of the error message.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by