octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: subasgn argument optimization


From: Judd Storrs
Subject: Re: FYI: subasgn argument optimization
Date: Fri, 14 Aug 2009 17:05:01 -0400

On Fri, Aug 14, 2009 at 1:05 PM, Jaroslav Hajek <address@hidden> wrote:
OK, here are some:

* A class is constructed from a struct. Can the struct be
multidimensional? (if the answer is no, then there is no need to read
further).

Apparently, yes. But, it seems to come out as an array of objects.

@foo/foo.m:
function obj = foo()
    obj(10).data = 1 ;
    obj = class(obj,'foo') ;
end

Then in matlab (I edited the whitespace):

>> a = foo()
a = foo object: 1-by-10
>> b = a(1)
b = foo object: 1-by-1
>>

Now I created

@bar/bar.m
function obj = foo()
    obj.data = 1 ;

    obj = class(obj,'foo') ;
end


>> b = bar()
??? Error using ==> class
Size of struct array being made into an object and the parent objects must be consistent.

Error in ==> bar.bar at 4
    obj = class(obj,'bar',parent) ;

>>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]