Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: GA parallel computing toolbox error
Date: Tue, 26 Aug 2008 13:25:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <g9107f$hio$1@fred.mathworks.com>
References: <g8h8v3$gjh$1@fred.mathworks.com> <g8he9l$9fn$1@fred.mathworks.com> <g8jert$doo$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1219757103 18008 172.30.248.38 (26 Aug 2008 13:25:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 26 Aug 2008 13:25:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:487303



> Does anyone know how to use local variables with the GA 
> objective function?

I have since solved this problem myself. To pass variables 
to a GA the fitness function must be specified as shown in 
the example below:

FitnessFcn=@(x)m_file_fitness_calc(x,other variables...)

then the ga is called using as: ga(FitnessFcn,other 
options...) etc.

Global variables was indeed causing the initial problem and 
once changed into local varibles using this method, the 
errors were eliminated.