MATLAB: Using find() on a vector of objects

comparisonfaq 6.1findfloating pointsearchvector

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?

Best Answer

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