[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: empty arrays of objects
From: |
Julien Bect |
Subject: |
Re: empty arrays of objects |
Date: |
Tue, 21 May 2013 07:49:16 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
On 21/05/2013 02:04, ernst wrote:
octave:28> a=arrayfun(@pn, [])
a = [](0x0)
octave:29> class(a)
ans = double
Hi Ernst,
If you intend your class to behave like a proprer array class, you
should probably "vectorize" your constructor also.
I mean that : x = pn([1 2 3]) should be the same as [pn(1) pn(2) pn(3)].
In this case, you wouldn't have to call arrayfun at all.
And the bonus is, if you call class(S, 'pn') with an empty structure S
in pn.m, then you get an empty array of class 'pn' as an output ;-)
@++
Julien