Using find() on a vector of objects

I'm trying to use find(...) to locate objects in a vector but can't make it work. I thought the following syntax would work:
p = find( obj.x == 1 )
but it doesn't. Why?

 Akzeptierte Antwort

Robert Cumming
Robert Cumming am 16 Mai 2011

0 Stimmen

do you want:
p = find ( [obj.x] == 1 )
if not, as suggested earlier can you show obj.x and the error message you get.

1 Kommentar

Niklas
Niklas am 16 Mai 2011
This is exacly what i was looking for, thanks!
How come you need the extra brackets?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Performance and Memory finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by