From: Richard on
Hi, I want to check for the existence of a user defined object in an array of these items. Something like this
An array containing
Object(1)
Object(23)
Object(35)

Is there a matlab command to check for the existence of Object(35) in this array without iterating through its elements?
From: neil on
"Richard " <REMOVETHISrcaldwellie(a)yahoo.com> wrote in message <i3d13f$b6f$1(a)fred.mathworks.com>...
> Hi, I want to check for the existence of a user defined object in an array of these items. Something like this
> An array containing
> Object(1)
> Object(23)
> Object(35)
>
> Is there a matlab command to check for the existence of Object(35) in this array without iterating through its elements?

I assume your matrix Object is a cell array? If that is the case
try
cellfun('isclass',object,'yourClassName')

This will produce a logical array were 1 (true) represents the element in the cell array is of the specified type.
From: Richard on
"neil " <neil.iain(a)gmail.com> wrote in message <i3d4q5$2f3$1(a)fred.mathworks.com>...
> "Richard " <REMOVETHISrcaldwellie(a)yahoo.com> wrote in message <i3d13f$b6f$1(a)fred.mathworks.com>...
> > Hi, I want to check for the existence of a user defined object in an array of these items. Something like this
> > An array containing
> > Object(1)
> > Object(23)
> > Object(35)
> >
> > Is there a matlab command to check for the existence of Object(35) in this array without iterating through its elements?
>
> I assume your matrix Object is a cell array? If that is the case
> try
> cellfun('isclass',object,'yourClassName')
>
> This will produce a logical array were 1 (true) represents the element in the cell array is of the specified type.
Thanks. Its actually an array of objects but now that you've sent me in the right direction I think arrayfun will do what I need
 | 
Pages: 1
Prev: video capture
Next: Integral Problem