Path: news.mathworks.com!not-for-mail
From: "Roman " <gnamor@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Fetching MATLAB function agrument list
Date: Wed, 8 Aug 2007 16:11:01 +0000 (UTC)
Organization: Rcadia Medical Imaging Ltd.
Lines: 51
Message-ID: <f9cpul$9ja$1@fred.mathworks.com>
References: <f9c2d2$2e4$1@fred.mathworks.com> <46b9be5c$1@news1-rz-ap.ethz.ch>
Reply-To: "Roman " <gnamor@yahoo.com>
NNTP-Posting-Host: webapp-00-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1186589461 9834 172.30.248.35 (8 Aug 2007 16:11:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 8 Aug 2007 16:11:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 770246
Xref: news.mathworks.com comp.soft-sys.matlab:423005


Michael Wild <themiwi.REMOVE.THIS@student.ethz.ch> wrote in 
message <46b9be5c$1@news1-rz-ap.ethz.ch>...
> Roman wrote:
> > Is there a way in MATLAB to get a list of function 
> > arguments (both input and output) as declared in M-file?
> > 
> > I.e. given a function 
> > function [out1, out2] = foo(in1, in2, in3)
> > defined in the foo.m file I'm interested in something 
like
> > 
> > [input_arg_list, output_arg_list] = fetch_arg_list
('foo.m');
> > 
> > Which would return
> > input_arg_list = {'in1', 'in2', 'in3'};
> > outpuy_arg_list = {'out1', 'out2'};
> > 
> > Thank you,
> > Roman
> > 
> > 
> > 
> > 
> 
> no. you could do it yourself though quite easily. but 
what are you going 
> to do in the many cases where varargin and varargout are 
used? or where 
> default arguments are provided in the code? and what 
would be the use of 
> such a fragile thing be anyways?
> 
> 
> michael

Hi,

I need this for some dynamic framework that would call 
functions of certain type (no vararg-s) automatically using 
'eval'. In order to compose the correct calling string for
the 'eval' I need to know the list of input and output 
arguments to the function. 
This is not a general purpose solution - just an automation
trick to make things easier for me.

By the way, do you know an easy and elegant way to parse 
MATLAB source to fetch these?

Thank you,
Roman