PARFOR Transparency violation error when using jcitest

I am trying to run some simulations that involves using using Johnansen's test, but I always receive a transparency violation error. I prepared a minimal working example of the problem below. Is there something about the jcitest() function which makes it impossible to use in a parfor loop? Is there a way to solve that problem?
p = 4;
parfor i=1:2
y = [cumsum( randn(100,1) ), cumsum( randn(100,1) )];
[h1,~,~,~,~] = jcitest(y, 'model', 'H1*', 'lags', p-1, ...
'test', 'trace', 'display', 'off');
end

댓글 수: 3

I don't get any transparency violation errors. Could you rerun your example to ensure it does or update the example to highlight the error?
I just opened another MATLAB process with everything clear in it. I got to the bottom of my script, launched this code exactly and got a transparency violation error. I joined a screen shot here. I have no idea why I have a transparency violation error and you don't, but I assure you that this exact code does produce such an error.
It turns out that if I define a function prior to the loop, say,
testing = @(y,p) jcitest(y, 'model', 'H1*', 'lags', p-1, ...
'test', 'trace', 'display', 'off');
and use it inside the loop, the problem completely goes away. I checked, double checked and triple checked... everything seem fine and it's going to massively help with my simulation study. I'll leave it here in case someone else runs into this weird problem.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2020년 11월 3일

댓글:

2020년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by