<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868</link>
    <title>MATLAB Central Newsreader - #include in matlab?</title>
    <description>Feed for thread: #include in matlab?</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>Thu, 13 Dec 2007 14:15:31 -0500</pubDate>
      <title>#include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#406051</link>
      <author>Gus </author>
      <description>I have an m file that's exceeding 6000 lines and I want to&lt;br&gt;
split it up into many separate function files so I can more&lt;br&gt;
readily browse them.&lt;br&gt;
&lt;br&gt;
Is there any way that I can create a file and somehow&lt;br&gt;
include it in the execution path so that I can still create&lt;br&gt;
function handles to subfunctions in that file from another m&lt;br&gt;
file?  Effectively, I want something like #include that I&lt;br&gt;
can use to split up a file up for a single program.</description>
    </item>
    <item>
      <pubDate>Thu, 13 Dec 2007 14:53:26 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#406058</link>
      <author>DanK</author>
      <description>On Dec 13, 9:15 am, &quot;Gus &quot; &amp;lt;lottg.nos...@janelia.hhmi.org&amp;gt; wrote:&lt;br&gt;
&amp;gt; I have an m file that's exceeding 6000 lines and I want to&lt;br&gt;
&amp;gt; split it up into many separate function files so I can more&lt;br&gt;
&amp;gt; readily browse them.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there any way that I can create a file and somehow&lt;br&gt;
&amp;gt; include it in the execution path so that I can still create&lt;br&gt;
&amp;gt; function handles to subfunctions in that file from another m&lt;br&gt;
&amp;gt; file?  Effectively, I want something like #include that I&lt;br&gt;
&amp;gt; can use to split up a file up for a single program.&lt;br&gt;
&lt;br&gt;
Gus,&lt;br&gt;
One way to do it is to use a switchyard function at the start of your&lt;br&gt;
mfile.  What I do is that I have a huge file which is called something&lt;br&gt;
like: application_support.m.  The application_support function at the&lt;br&gt;
top of the file takes the first input to the function and uses a&lt;br&gt;
switch statement to compare it against all of the subfunctions, and&lt;br&gt;
then passes all the other input arguments to the subfunction.   Here's&lt;br&gt;
an example:&lt;br&gt;
&lt;br&gt;
function varargout=VL200s_support(Fcn,varargin)&lt;br&gt;
&lt;br&gt;
% VL200s_support - Support routines for VL200 &amp; VL300 processing&lt;br&gt;
% Switchyarded routine for many subroutines&lt;br&gt;
% Syntax: varargout=VL200s_support(Fcn,varargin)&lt;br&gt;
% Fcn - Description&lt;br&gt;
% varargin - Description&lt;br&gt;
% varargout - Description&lt;br&gt;
%   Example&lt;br&gt;
%  Line 1 of example&lt;br&gt;
%&lt;br&gt;
% Subfunctions: VL200_Gen_ProcOPTS, set_constants, filterinit,&lt;br&gt;
prepareData,&lt;br&gt;
% processData, calculateFirstPeak, calculateAllPeaks,&lt;br&gt;
load_Cal_spectra,&lt;br&gt;
% VL200_LoadFiles, applyFilter&lt;br&gt;
%   See also: VL200_main&lt;br&gt;
&lt;br&gt;
%% Create a switchyard for the functions:&lt;br&gt;
varargout=cell(1,nargout);&lt;br&gt;
switch lower(Fcn)&lt;br&gt;
	case 'loadonevlfile'&lt;br&gt;
		[varargout{:}]=loadOneVLFile(varargin{:});&lt;br&gt;
	case 'gen_procopts'&lt;br&gt;
		[varargout{:}]=VL200_Gen_ProcOPTS(varargin);&lt;br&gt;
	case 'set_constants'&lt;br&gt;
		[varargout{:}]=set_constants(varargin);&lt;br&gt;
	case 'filterinit'&lt;br&gt;
		[varargout{:}]=filterinit(varargin);&lt;br&gt;
	case 'preparedata'&lt;br&gt;
		[varargout{:}]=prepareData(varargin{1},varargin{2},varargin{3});&lt;br&gt;
	case 'processdata'&lt;br&gt;
		[varargout{:}]=processData(varargin{1},varargin{2},varargin{3});&lt;br&gt;
	case 'load_cal_spectra'&lt;br&gt;
		[varargout{:}]=load_Cal_spectra(varargin{1},varargin{2});&lt;br&gt;
	case 'applyfilter'&lt;br&gt;
		[varargout{:}]=applyFilter(varargin{:});&lt;br&gt;
	case 'getrev'&lt;br&gt;
		[varargout{:}]=getRev(varargin{:});&lt;br&gt;
end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
then I when I want to call the applyFilter routine I use the following&lt;br&gt;
syntax:&lt;br&gt;
&lt;br&gt;
[powerSpectrum,spectrumFiltered,cleaned]=...&lt;br&gt;
	VL200s_support('applyFilter',spectrum,lpFilter,Const,cleaned);&lt;br&gt;
&lt;br&gt;
where the 'applyFilter' string identifies the &quot;real&quot; function I'm&lt;br&gt;
calling.&lt;br&gt;
&lt;br&gt;
HTH,&lt;br&gt;
Dan</description>
    </item>
    <item>
      <pubDate>Thu, 13 Dec 2007 14:59:25 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#406059</link>
      <author>Randy Poe</author>
      <description>On Dec 13, 9:15 am, &quot;Gus &quot; &amp;lt;lottg.nos...@janelia.hhmi.org&amp;gt; wrote:&lt;br&gt;
&amp;gt; I have an m file that's exceeding 6000 lines and I want to&lt;br&gt;
&amp;gt; split it up into many separate function files so I can more&lt;br&gt;
&amp;gt; readily browse them.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there any way that I can create a file and somehow&lt;br&gt;
&amp;gt; include it in the execution path so that I can still create&lt;br&gt;
&amp;gt; function handles to subfunctions in that file from another m&lt;br&gt;
&amp;gt; file?  Effectively, I want something like #include that I&lt;br&gt;
&amp;gt; can use to split up a file up for a single program.&lt;br&gt;
&lt;br&gt;
One suggestion: Write your subblocks as scripts&lt;br&gt;
(no FUNCTION line), so they will execute just as if they&lt;br&gt;
were written inline.&lt;br&gt;
&lt;br&gt;
function myfun(a,b,c)&lt;br&gt;
block1;&lt;br&gt;
block2;&lt;br&gt;
block3;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Randy</description>
    </item>
    <item>
      <pubDate>Thu, 13 Dec 2007 18:05:09 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#406100</link>
      <author>Dan Hensley</author>
      <description>Gus wrote:&lt;br&gt;
&amp;gt; I have an m file that's exceeding 6000 lines and I want to&lt;br&gt;
&amp;gt; split it up into many separate function files so I can more&lt;br&gt;
&amp;gt; readily browse them.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Is there any way that I can create a file and somehow&lt;br&gt;
&amp;gt; include it in the execution path so that I can still create&lt;br&gt;
&amp;gt; function handles to subfunctions in that file from another m&lt;br&gt;
&amp;gt; file?  Effectively, I want something like #include that I&lt;br&gt;
&amp;gt; can use to split up a file up for a single program.&lt;br&gt;
&lt;br&gt;
Here's another suggestion that I use a lot when I want to include a &lt;br&gt;
&quot;library&quot; of functions included in another .m file.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Your &quot;library&quot;:&lt;br&gt;
&lt;br&gt;
-------------------------------------&lt;br&gt;
function h = myLibrary;&lt;br&gt;
&lt;br&gt;
h.func1 = @func1;&lt;br&gt;
h.func2 = @func2;&lt;br&gt;
&lt;br&gt;
function out = func1(in1,in2)&lt;br&gt;
% your code&lt;br&gt;
&lt;br&gt;
function varargout = func2(varargin)&lt;br&gt;
% etc.&lt;br&gt;
-------------------------------------&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Now in your calling function:&lt;br&gt;
&lt;br&gt;
function myFunction&lt;br&gt;
&lt;br&gt;
% Get the handles from the library&lt;br&gt;
h = myLibrary;&lt;br&gt;
&lt;br&gt;
% use one of them&lt;br&gt;
&lt;br&gt;
in1=1; in2='string';&lt;br&gt;
out = h.func(in1,in2);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Dan</description>
    </item>
    <item>
      <pubDate>Sun, 23 Dec 2007 14:17:16 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#407113</link>
      <author>Gus </author>
      <description>Thanks Dan,&lt;br&gt;
&lt;br&gt;
That's an elegant implementation and pretty much what I was&lt;br&gt;
looking for :)&lt;br&gt;
&lt;br&gt;
Cheers</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 01:12:04 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#614623</link>
      <author>Edward </author>
      <description>&quot;Gus &quot; &amp;lt;lottg.nospam@janelia.hhmi.org&amp;gt; wrote in message &amp;lt;fklqlc$8mv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Thanks Dan,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; That's an elegant implementation and pretty much what I was&lt;br&gt;
&amp;gt; looking for :)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Cheers&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I have a very similar problem (my program is only 3000 lines), but I don't understand why I can't use something more akin to #include. Is there any command that simply copies one '.m' file into another? Dividing each function into an independent file is rather annoying. I would like to something like this:&lt;br&gt;
&lt;br&gt;
&quot;test.m&quot;:&lt;br&gt;
% Include statement for &quot;testlib.m&quot;&lt;br&gt;
function myfunc()&lt;br&gt;
add(2,3)&lt;br&gt;
multiply(2,3)&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;testlib.m&quot;&lt;br&gt;
function [out] = add(in1,in2)&lt;br&gt;
out = in1+in2;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
function [out] = multiply(in1,in2)&lt;br&gt;
out = in1*in2;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
Ed</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 01:32:36 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#614628</link>
      <author>Walter Roberson</author>
      <description>Edward wrote:&lt;br&gt;
&amp;gt; I don't understand why I can't use something more akin to #include. Is there any command&lt;br&gt;
&amp;gt; that simply copies one '.m' file into another?&lt;br&gt;
&lt;br&gt;
No, not when the .m file can contain function definitions. If it does not contain function&lt;br&gt;
definitions, then you could use a &quot;script&quot;.&lt;br&gt;
&lt;br&gt;
&amp;gt; Dividing each function into an independent file is rather annoying. I would like to something&lt;br&gt;
&amp;gt; like this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;test.m&quot;:&lt;br&gt;
&amp;gt; % Include statement for &quot;testlib.m&quot;&lt;br&gt;
&amp;gt; function myfunc()&lt;br&gt;
&amp;gt; add(2,3)&lt;br&gt;
&amp;gt; multiply(2,3)&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;testlib.m&quot;&lt;br&gt;
&amp;gt; function [out] = add(in1,in2)&lt;br&gt;
&amp;gt; out = in1+in2;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function [out] = multiply(in1,in2)&lt;br&gt;
&amp;gt; out = in1*in2;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&lt;br&gt;
Objects and methods then.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
.signature note: I am now avoiding replying to unclear or ambiguous postings.&lt;br&gt;
Please review questions before posting them. Be specific. Use examples of what you mean,&lt;br&gt;
of what you don't mean. Specify boundary conditions, and data classes and value&lt;br&gt;
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 01:43:01 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#614629</link>
      <author>Joaquim Luis</author>
      <description>DanK &amp;lt;dkominsky@primephotonics.com&amp;gt; wrote in message &amp;lt;aa5dace9-d6cc-4879-a706-&lt;br&gt;
&amp;gt; Gus,&lt;br&gt;
&amp;gt; One way to do it is to use a switchyard function at the start of your&lt;br&gt;
&amp;gt; mfile.  What I do is that I have a huge file which is called something&lt;br&gt;
&amp;gt; like: application_support.m.  The application_support function at the&lt;br&gt;
&amp;gt; top of the file takes the first input to the function and uses a&lt;br&gt;
&amp;gt; switch statement to compare it against all of the subfunctions, and&lt;br&gt;
&amp;gt; then passes all the other input arguments to the subfunction.   Here's&lt;br&gt;
&amp;gt; an example:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function varargout=VL200s_support(Fcn,varargin)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % VL200s_support - Support routines for VL200 &amp; VL300 processing&lt;br&gt;
&amp;gt; % Switchyarded routine for many subroutines&lt;br&gt;
&amp;gt; % Syntax: varargout=VL200s_support(Fcn,varargin)&lt;br&gt;
&amp;gt; % Fcn - Description&lt;br&gt;
&amp;gt; % varargin - Description&lt;br&gt;
&amp;gt; % varargout - Description&lt;br&gt;
&amp;gt; %   Example&lt;br&gt;
&amp;gt; %  Line 1 of example&lt;br&gt;
&amp;gt; %&lt;br&gt;
&amp;gt; % Subfunctions: VL200_Gen_ProcOPTS, set_constants, filterinit,&lt;br&gt;
&amp;gt; prepareData,&lt;br&gt;
&amp;gt; % processData, calculateFirstPeak, calculateAllPeaks,&lt;br&gt;
&amp;gt; load_Cal_spectra,&lt;br&gt;
&amp;gt; % VL200_LoadFiles, applyFilter&lt;br&gt;
&amp;gt; %   See also: VL200_main&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %% Create a switchyard for the functions:&lt;br&gt;
&amp;gt; varargout=cell(1,nargout);&lt;br&gt;
&amp;gt; switch lower(Fcn)&lt;br&gt;
&amp;gt; 	case 'loadonevlfile'&lt;br&gt;
&amp;gt; 		[varargout{:}]=loadOneVLFile(varargin{:});&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
&amp;gt; then I when I want to call the applyFilter routine I use the following&lt;br&gt;
&amp;gt; syntax:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [powerSpectrum,spectrumFiltered,cleaned]=...&lt;br&gt;
&amp;gt; 	VL200s_support('applyFilter',spectrum,lpFilter,Const,cleaned);&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Actually you can reduce the obove solution to (that's what I use)&lt;br&gt;
&lt;br&gt;
function  varargout = my_funs(fun,varargin)&lt;br&gt;
% Library of some functions&lt;br&gt;
&lt;br&gt;
	if (nargout)&lt;br&gt;
		[varargout{1:nargout}] = feval(fun, varargin{:});&lt;br&gt;
	else&lt;br&gt;
		feval(fun, varargin{:});&lt;br&gt;
	end</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 15:10:50 -0500</pubDate>
      <title>Re: #include in matlab?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160868#614764</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Joaquim Luis&quot; &amp;lt;jluis@--ualg--.pt&amp;gt; wrote in message &lt;br&gt;
news:gh4o75$id1$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; DanK &amp;lt;dkominsky@primephotonics.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;aa5dace9-d6cc-4879-a706-&lt;br&gt;
&amp;gt;&amp;gt; Gus,&lt;br&gt;
&amp;gt;&amp;gt; One way to do it is to use a switchyard function at the start of your&lt;br&gt;
&amp;gt;&amp;gt; mfile.  What I do is that I have a huge file which is called something&lt;br&gt;
&amp;gt;&amp;gt; like: application_support.m.  The application_support function at the&lt;br&gt;
&amp;gt;&amp;gt; top of the file takes the first input to the function and uses a&lt;br&gt;
&amp;gt;&amp;gt; switch statement to compare it against all of the subfunctions, and&lt;br&gt;
&amp;gt;&amp;gt; then passes all the other input arguments to the subfunction.   Here's&lt;br&gt;
&amp;gt;&amp;gt; an example:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; function varargout=VL200s_support(Fcn,varargin)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; % VL200s_support - Support routines for VL200 &amp; VL300 processing&lt;br&gt;
&amp;gt;&amp;gt; % Switchyarded routine for many subroutines&lt;br&gt;
&amp;gt;&amp;gt; % Syntax: varargout=VL200s_support(Fcn,varargin)&lt;br&gt;
&amp;gt;&amp;gt; % Fcn - Description&lt;br&gt;
&amp;gt;&amp;gt; % varargin - Description&lt;br&gt;
&amp;gt;&amp;gt; % varargout - Description&lt;br&gt;
&amp;gt;&amp;gt; %   Example&lt;br&gt;
&amp;gt;&amp;gt; %  Line 1 of example&lt;br&gt;
&amp;gt;&amp;gt; %&lt;br&gt;
&amp;gt;&amp;gt; % Subfunctions: VL200_Gen_ProcOPTS, set_constants, filterinit,&lt;br&gt;
&amp;gt;&amp;gt; prepareData,&lt;br&gt;
&amp;gt;&amp;gt; % processData, calculateFirstPeak, calculateAllPeaks,&lt;br&gt;
&amp;gt;&amp;gt; load_Cal_spectra,&lt;br&gt;
&amp;gt;&amp;gt; % VL200_LoadFiles, applyFilter&lt;br&gt;
&amp;gt;&amp;gt; %   See also: VL200_main&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; %% Create a switchyard for the functions:&lt;br&gt;
&amp;gt;&amp;gt; varargout=cell(1,nargout);&lt;br&gt;
&amp;gt;&amp;gt; switch lower(Fcn)&lt;br&gt;
&amp;gt;&amp;gt; case 'loadonevlfile'&lt;br&gt;
&amp;gt;&amp;gt; [varargout{:}]=loadOneVLFile(varargin{:});&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; then I when I want to call the applyFilter routine I use the following&lt;br&gt;
&amp;gt;&amp;gt; syntax:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; [powerSpectrum,spectrumFiltered,cleaned]=...&lt;br&gt;
&amp;gt;&amp;gt; VL200s_support('applyFilter',spectrum,lpFilter,Const,cleaned);&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Actually you can reduce the obove solution to (that's what I use)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; function  varargout = my_funs(fun,varargin)&lt;br&gt;
&amp;gt; % Library of some functions&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; if (nargout)&lt;br&gt;
&amp;gt; [varargout{1:nargout}] = feval(fun, varargin{:});&lt;br&gt;
&amp;gt; else&lt;br&gt;
&amp;gt; feval(fun, varargin{:});&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
Rather than having the switchyard in the &quot;library function&quot;, I'd build a &lt;br&gt;
&quot;function struct&quot;:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% begin my_funs.m&lt;br&gt;
function S = my_funs&lt;br&gt;
&lt;br&gt;
S.VL200s_support = @VL200s_support;&lt;br&gt;
S.prepareData = @prepareData;&lt;br&gt;
% etc.&lt;br&gt;
&lt;br&gt;
function y = VL200s_support(input1, input2, etc)&lt;br&gt;
...&lt;br&gt;
% end my_funs.m&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
That way I only need to call my_funs once, to retrieve the struct; when I &lt;br&gt;
want to invoke one of the functions from the &quot;function struct&quot;, I simply &lt;br&gt;
perform a struct reference and directly call the function via the function &lt;br&gt;
handle.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
functionTable = my_funs;&lt;br&gt;
supportOutput = functionTable.VL200s_support(in1, in2, in3);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I can even use dynamic field names, if you need or want to allow the user to &lt;br&gt;
select what function should be run.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
z = functionTable.(selectedFunction)(...)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Another benefit of this is that if the functions whose handles you store in &lt;br&gt;
the &quot;function struct&quot; are in separate files, things like DEPFUN will &lt;br&gt;
recognize that my_funs depends on those separate files (because I'm creating &lt;br&gt;
a function handle to it) whereas if you pass in the name of the function, it &lt;br&gt;
may not.  This is the same type of issue as the missing callback problem &lt;br&gt;
described here:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/bq6ae_n-1.html#bq6ae_n-6&quot;&gt;http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/bq6ae_n-1.html#bq6ae_n-6&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
  </channel>
</rss>

