Path: news.mathworks.com!not-for-mail
From: "Paul Mennen" <nospam@mennen.org>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Programmatic GUI
Date: Sat, 3 Oct 2009 02:01:04 +0000 (UTC)
Organization: Sigknowledge
Lines: 19
Message-ID: <ha6b90$lj1$1@fred.mathworks.com>
References: <ha07o2$amv$1@fred.mathworks.com> <ha08ar$kgf$1@fred.mathworks.com>
Reply-To: "Paul Mennen" <nospam@mennen.org>
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 1254535264 22113 172.30.248.38 (3 Oct 2009 02:01:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 3 Oct 2009 02:01:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869812
Xref: news.mathworks.com comp.soft-sys.matlab:574611


"Matt Fig" wrote 
>  There are two approaches here:
> http://www.mathworks.com/matlabcentral/fileexchange/24861

Hi Matt.  I was looking at the GUI examples in your FEX submission mentioned above and I have a question for you about it. In (for example) GUI_11 you have the following:

function [] = ed_call(varargin)
[h,S] = varargin{[1,3]}; 

My attention was drawn to that, since I happened to be using an older version of Matlab, and this didn't work. I noticed I could get it to work, by adding the "deal" function. That is:
[h,S] = deal(varargin{[1,3]});

But whether you have the deal function in there or not, isn't this a somewhat cryptic way of calling the function? It seems much more straight forward to replace the two lines above with this single line:

function ed_call(h,arg2,S)

Not only does it work across versions, but it seems much clearer as well. You seem to think carefully about your programming style, so I suspect you had a reason for doing it the way you did, although I can't see it.

~Paul