access properties from an array of objects as an array?
3 ビュー (過去 30 日間)
古いコメントを表示
Assume:
- obj = an object instance of a class
- obj has a property a such that obj.a = <double>
- listOfObj = repmat(obj, 10, 1)
I want to search through the set of properties that exists in an array of objects. For example,
find( obj(:).a == 3)
However, that doesn't really work. What are the intelligent approaches?
0 件のコメント
採用された回答
Guillaume
2018 年 6 月 20 日
find([obj.a] == 3)
This assumes that a is scalar for all elements of array obj.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Construct and Work with Object Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!