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?

 採用された回答

Robert Cumming
Robert Cumming 2011 年 5 月 16 日

0 投票

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 件のコメント

Niklas
Niklas 2011 年 5 月 16 日
This is exacly what i was looking for, thanks!
How come you need the extra brackets?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePerformance and Memory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by