[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2.9.6?
From: |
John W. Eaton |
Subject: |
Re: 2.9.6? |
Date: |
Thu, 8 Jun 2006 21:44:27 -0400 |
On 9-Jun-2006, David Bateman wrote:
| I motice you slipped the handling of code like
|
| a = cell(1,4);
| [a{:}] = fileparts("/var/log/syslog.1");
|
| into the CVS without any comment. For such a longstanding missing
| feature, I thought there would be more fanfare ;-)
I sent the following to the help list but it was delayed due to some
mailing list trouble so maybe that's why you missed it. I thought I
also copied it to the OP, but I guess not.
jwe
Subject: Re: Variable number of function return values
From: "John W. Eaton" <address@hidden>
To: address@hidden
Cc: Help-Octave <address@hidden>
Date: Wed, 7 Jun 2006 14:29:01 -0400
Message-ID: <address@hidden>
On 2-Jun-2006, David Bateman wrote:
| Gregor Beck wrote:
|
| > I try to get a variable number of return values from a function.
| > With matlab something like this does the trick:
| >
| > C = cell(1, 4);
| > [C{:}] = fileparts('work/mytests/strArrays.mat')
| >
| > C =
| > 'work/mytests' 'strArrays' '.mat' ''
| >
| > But with octave (2.9.5 & 2.1.44) I get
| >
| > C =
| > {
| > [1,1] = work/mytests
| > [1,2] = work/mytests
| > [1,3] = work/mytests
| > [1,4] = work/mytests
| > }
| >
| > Is this the intended behavior?
| > Is there another way to achieve this?
|
| This one has been on the TODO list for at least 4 years.
I've checked in a partial implementation of this feature (at long
last, progress!). The following kinds of things work:
x = cell (1, 2);
[a, x{:}, b] = deal (1, 2, 3, 4);
[a, x{1:4}, b] = deal (1, 2, 3, 4, 5, 6);
[y.z{1:3}] = deal (1, 2, 3);
but these do not:
[x{1:2,1:2}] = deal (1, 2, 3, 4);
x(3).a = [];
[x.a] = deal (1, 2, 3);
I don't have immediate plans to work on these additional features, so
if someone else is interested, please let me know. I can send you the
diffs for my changes if it would help you get started (it is less than
500 lines of diff -u output).
The last time I looked at this problem, I thought it would require
changes to the interface for the subsasgn method in the octave_value
class hierarchy, but I found another way to do it that doesn't require
interface changes, so this feature should not force any changes on
user-defined types.
jwe
_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave
- 2.9.6?, John W. Eaton, 2006/06/08
- Re: 2.9.6?, David Bateman, 2006/06/08
- Re: 2.9.6?,
John W. Eaton <=