My code is too slow, so i tried using 'parfor' like below
parfor i = 1:26
etatl=(i*10)+90;
xil=etatl+3;
for j= 1:20
qso=j*0.00005
qmo = 0.001-qso;
fbt_ % this is my code for calculation
end
end
=============================================
but i still get error, 'UndefinedFunction error in 'etatl' worker.
use addAttachedFiles(pool,files) and attach needed files. check 'parallel.Pool/addAttachedFile'.
=====
i checked 'parallel.Pool/addAttachedFile' but i still don't know how to solve the problem..

 채택된 답변

Edric Ellis
Edric Ellis 2020년 7월 6일

0 개 추천

I think the problem here is that "fbt_.m" is a script file. You should convert it to a function. More in the doc about scripts and functions here: https://www.mathworks.com/help/matlab/matlab_prog/scripts-and-functions.html .

댓글 수: 2

Minsik Km
Minsik Km 2020년 7월 7일
thank you!
i will try that way.
José Devienne
José Devienne 2021년 9월 13일
Have you tried, Minsik Km?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

질문:

2020년 7월 6일

댓글:

2021년 9월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by