<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393</link>
    <title>MATLAB Central Newsreader - attempt to execute script varargin as a function</title>
    <description>Feed for thread: attempt to execute script varargin as a function</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 01 Sep 2008 10:16:35 -0400</pubDate>
      <title>attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598185</link>
      <author>Dave Brackett</author>
      <description>I have been trying to use the Hybrid Particle Swarm &lt;br&gt;
Optimization function from the file exchange by Alexandros &lt;br&gt;
Leontitsis:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
.do?objectId=6497&amp;objectType=file&lt;br&gt;
&lt;br&gt;
I am running this from within an m file but keep getting &lt;br&gt;
the following error message:&lt;br&gt;
&lt;br&gt;
??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
C:\Program &lt;br&gt;
Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;options=hPSOoptions(varargin);&lt;br&gt;
&lt;br&gt;
Anyone any ideas on how to avoid this problem? Thanks.</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 12:04:20 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598193</link>
      <author>heiko_marx@hotmail.com</author>
      <description>On 1 Sep., 12:16, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; C:\Program&lt;br&gt;
&amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&lt;br&gt;
Hi.&lt;br&gt;
&lt;br&gt;
Do you have any input arguments in your function main_vectorised? Is&lt;br&gt;
the variable varargin existing at this point in the code?&lt;br&gt;
&lt;br&gt;
Heiko</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 13:04:53 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598196</link>
      <author>Dave</author>
      <description>On Sep 1, 1:04=A0pm, heiko_m...@hotmail.com wrote:&lt;br&gt;
&amp;gt; On 1 Sep., 12:16, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; &amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; &amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; &amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; &amp;gt; C:\Program&lt;br&gt;
&amp;gt; &amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; &amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Do you have any input arguments in your function main_vectorised? Is&lt;br&gt;
&amp;gt; the variable varargin existing at this point in the code?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Heiko- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
If you look at this help reference:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/ref/varargin.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/ref/varargin.html&lt;/a&gt;&lt;br&gt;
you will see that varargin is short for variable length input argument&lt;br&gt;
list and so shouldn't need defining prior to using it, or so I&lt;br&gt;
believe. have you used varargin before from within a function? Thanks&lt;br&gt;
for your reply. Dave</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 13:50:53 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598201</link>
      <author>woodchips@rochester.rr.com</author>
      <description>On Sep 1, 6:16=A0am, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; C:\Program&lt;br&gt;
&amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&lt;br&gt;
What you need to show us, is how you called that&lt;br&gt;
tool.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 14:28:42 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598208</link>
      <author>Dave</author>
      <description>On Sep 1, 2:50=A0pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt; On Sep 1, 6:16=A0am, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; &amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; &amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; &amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; &amp;gt; C:\Program&lt;br&gt;
&amp;gt; &amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; &amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; What you need to show us, is how you called that&lt;br&gt;
&amp;gt; tool.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; John- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
ok, it was done like this where the functions are the hybrid pso from&lt;br&gt;
the file exchange:&lt;br&gt;
&lt;br&gt;
options=3DhPSOoptions(variable_range,varargin);&lt;br&gt;
[x,fval,gfx,output]=3DhPSO(fitness_fcn,no_variables,options,varargin);&lt;br&gt;
&lt;br&gt;
please ask if you need any more details. thanks. Dave</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 14:46:27 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598210</link>
      <author>dpb</author>
      <description>Dave wrote:&lt;br&gt;
&amp;gt; On Sep 1, 2:50 pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt;&amp;gt; On Sep 1, 6:16 am, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the following error message:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; C:\Program Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Error in ==&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;     options=hPSOoptions(varargin);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&amp;gt;&amp;gt; What you need to show us, is how you called that&lt;br&gt;
&amp;gt;&amp;gt; tool.&lt;br&gt;
...&lt;br&gt;
&amp;gt; ok, it was done like this ...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; options=hPSOoptions(variable_range,varargin);&lt;br&gt;
&lt;br&gt;
As the error message says, you tried to use varargin in a place that &lt;br&gt;
requires a set of input variables.&lt;br&gt;
&lt;br&gt;
&quot;varargin&quot; is a built-in Matlab function, not a stand in name for the &lt;br&gt;
variables which the function hPSOoptions is expecting to do something &lt;br&gt;
with internally.&lt;br&gt;
&lt;br&gt;
Read the help w/ the FEX functions to see what is expected to be passed, &lt;br&gt;
but it will have to be a variable or an array (or perhaps even nothing &lt;br&gt;
if there are defaults supplied internal to the function for all possible &lt;br&gt;
inputs), but it can't be a Matlab-reserved keyword or function.&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
&lt;br&gt;
&amp;gt; [x,fval,gfx,output]=hPSO(fitness_fcn,no_variables,options,varargin);&lt;br&gt;
&lt;br&gt;
Ditto above...&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 14:51:32 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598211</link>
      <author>woodchips@rochester.rr.com</author>
      <description>On Sep 1, 10:28=A0am, Dave &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; On Sep 1, 2:50=A0pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; On Sep 1, 6:16=A0am, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; C:\Program&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; What you need to show us, is how you called that&lt;br&gt;
&amp;gt; &amp;gt; tool.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; John- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ok, it was done like this where the functions are the hybrid pso from&lt;br&gt;
&amp;gt; the file exchange:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; options=3DhPSOoptions(variable_range,varargin);&lt;br&gt;
&amp;gt; [x,fval,gfx,output]=3DhPSO(fitness_fcn,no_variables,options,varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; please ask if you need any more details. thanks. Dave&lt;br&gt;
&lt;br&gt;
Why are you passing in varargin?&lt;br&gt;
&lt;br&gt;
varargin is NOT a variable that you should pass in.&lt;br&gt;
&lt;br&gt;
Read the help for the hPSO tools. Learn how&lt;br&gt;
to call them as they are designed to be called.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Mon, 01 Sep 2008 15:15:25 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598214</link>
      <author>Dave</author>
      <description>On Sep 1, 3:51=A0pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt; On Sep 1, 10:28=A0am, Dave &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; On Sep 1, 2:50=A0pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; On Sep 1, 6:16=A0am, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wrote=&lt;br&gt;
:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; C:\Program&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; What you need to show us, is how you called that&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; tool.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; John- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ok, it was done like this where the functions are the hybrid pso from&lt;br&gt;
&amp;gt; &amp;gt; the file exchange:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; options=3DhPSOoptions(variable_range,varargin);&lt;br&gt;
&amp;gt; &amp;gt; [x,fval,gfx,output]=3DhPSO(fitness_fcn,no_variables,options,varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; please ask if you need any more details. thanks. Dave&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Why are you passing in varargin?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; varargin is NOT a variable that you should pass in.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Read the help for the hPSO tools. Learn how&lt;br&gt;
&amp;gt; to call them as they are designed to be called.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; John- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
There actually is not much help for these functions. I have worked out&lt;br&gt;
that it can just be excluded such that it is called like this:&lt;br&gt;
&lt;br&gt;
options=3DhPSOoptions(variable_range);&lt;br&gt;
[x,fval,gfx,output]=3DhPSO(fitness_fcn,no_variables,options);&lt;br&gt;
&lt;br&gt;
Thanks for your help with this.</description>
    </item>
    <item>
      <pubDate>Tue, 02 Sep 2008 06:10:59 -0400</pubDate>
      <title>Re: attempt to execute script varargin as a function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235393#598267</link>
      <author>heiko_marx@hotmail.com</author>
      <description>On 1 Sep., 17:15, Dave &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; On Sep 1, 3:51=A0pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; On Sep 1, 10:28=A0am, Dave &amp;lt;davebrack...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; On Sep 1, 2:50=A0pm, woodch...@rochester.rr.com wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; On Sep 1, 6:16=A0am, &quot;Dave Brackett&quot; &amp;lt;davebrack...@hotmail.com&amp;gt; wro=&lt;br&gt;
te:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; I have been trying to use the Hybrid Particle Swarm&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Optimization function from the file exchange by Alexandros&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Leontitsis:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .do?objectId=3D6497&amp;objectType=3Dfile&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; I am running this from within an m file but keep getting&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; ??? Attempt to execute SCRIPT varargin as a function:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; C:\Program&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Files\MATLAB\R2008a\toolbox\matlab\lang\varargin.m&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Error in =3D=3D&amp;gt; main_vectorised at 160&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; =A0 =A0 options=3DhPSOoptions(varargin);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Anyone any ideas on how to avoid this problem? Thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; What you need to show us, is how you called that&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; tool.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; John- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ok, it was done like this where the functions are the hybrid pso from&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; the file exchange:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; options=3DhPSOoptions(variable_range,varargin);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; [x,fval,gfx,output]=3DhPSO(fitness_fcn,no_variables,options,varargin)=&lt;br&gt;
;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; please ask if you need any more details. thanks. Dave&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Why are you passing in varargin?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; varargin is NOT a variable that you should pass in.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Read the help for the hPSO tools. Learn how&lt;br&gt;
&amp;gt; &amp;gt; to call them as they are designed to be called.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; John- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; There actually is not much help for these functions. I have worked out&lt;br&gt;
&amp;gt; that it can just be excluded such that it is called like this:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; options=3DhPSOoptions(variable_range);&lt;br&gt;
&amp;gt; [x,fval,gfx,output]=3DhPSO(fitness_fcn,no_variables,options);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks for your help with this.&lt;br&gt;
&lt;br&gt;
Hi again.&lt;br&gt;
&lt;br&gt;
I think you have to know what varargin in MatLab actually is meant to&lt;br&gt;
be. MatLab functions define input and output arguments. There are two&lt;br&gt;
main approaches to define a function:&lt;br&gt;
&lt;br&gt;
1. Assign input and output arguments directly to variables, i.e.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[a, b, c] =3D fun_name(in1, in2);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Here, the function takes two input arguments and stores them for&lt;br&gt;
internal use into the variables in1 and in2.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;It also outputs three arguments that have to be created inside the&lt;br&gt;
function.&lt;br&gt;
&lt;br&gt;
2. The number and type of input and output arguments is variable:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;varargout =3D fun_name(varargin);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;MatLab allows functions to have a variable interface for&lt;br&gt;
functions. In this case, all input arguments are stored&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in a cell array named varargin, with nargin elements. You can&lt;br&gt;
access these with varargin{1} ... varargin{nargin}.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Analog, you have to assign all output variables to varargout,&lt;br&gt;
where the number of output arguments that the&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function was called with is nargout (i.e. [a, b] =3D fun_name(in1) -&lt;br&gt;
&amp;gt; nargout =3D 2, nargin =3D 1). See the doc.&lt;br&gt;
&lt;br&gt;
So if the help for hPSO states that hPSO takes varargin as one of the&lt;br&gt;
input arguments, it means that you can pass a flexible number of input&lt;br&gt;
arguments explained further in the help somewhere. It also means, that&lt;br&gt;
if your function receives varargin when it is called you can pass this&lt;br&gt;
cell array directly to hPSO if it contains valid options, like:&lt;br&gt;
&lt;br&gt;
function my_fun(varargin)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;out =3D hPSO(varargin);&lt;br&gt;
&lt;br&gt;
This is what I meant with my first answer: if inside your call the&lt;br&gt;
variable varargin is existing, this error should not appear.&lt;br&gt;
Otherwise, replace varargin by valid options, like:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;out =3D hPSO(opt1, opt2, ...);&lt;br&gt;
&lt;br&gt;
Hope this helps,&lt;br&gt;
Heiko</description>
    </item>
  </channel>
</rss>

