필터 지우기
필터 지우기

does parfor support global variables?

조회 수: 7 (최근 30일)
Sampath reddy
Sampath reddy 2012년 3월 24일
I want to use global variables in the functions run in parallel using parfor. Is it possible?

답변 (1개)

Edric Ellis
Edric Ellis 2012년 3월 26일
There are two restrictions.
  1. You cannot place a GLOBAL declaration directly inside a PARFOR loop
  2. The MATLAB workers executing the body of your PARFOR loop are separate MATLAB processes, and the values of global variables are not synchronised
So, while you can use GLOBAL variables within functions called from the body of your PARFOR loop, they probably do not behave as you wish.

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by