access properties from an array of objects as an array?
조회 수: 4 (최근 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!