Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Function output dimensions
Date: Wed, 9 Sep 2009 21:56:04 +0000 (UTC)
Organization: Universit&#228;t  Bremen
Lines: 22
Message-ID: <h8989k$eoh$1@fred.mathworks.com>
References: <h895aj$85$1@fred.mathworks.com> <20fc924a-07bc-4bf2-9bb3-b38f7425286c@m7g2000prd.googlegroups.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 1252533364 15121 172.30.248.38 (9 Sep 2009 21:56:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Sep 2009 21:56:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1426778
Xref: news.mathworks.com comp.soft-sys.matlab:569396


> you would have to do:
> 
> [ab(1) ab(2)] = ind2sub([3 3],5);
> 
> By specifying only one output for ind2sub, such as when you type:
> 
> ab = ind2sub([3 3],5);
> 
> it doesn't care that ab used to be a 2x1 vector.  It will override
> that and make it a 1x1 vector, since you're telling ind2sub to only
> return one variable.

Thanks!

I just realized I don't have a question in my original post!!!

I realize I can do what you suggest but what I want to do is to be able to specify an output without MATLAB overwriting it and checking its dimensions. My idea is for this function to work regardless of the dimensions, such as replacing:
[ab(1) ab(2) ... ab(N)] = function(...)
with
[ab(1:N)] = function(...)

Cheers, Andr