access properties from an array of objects as an array?

3 次查看(过去 30 天)
Assume:
  1. obj = an object instance of a class
  2. obj has a property a such that obj.a = <double>
  3. 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?

采纳的回答

Guillaume
Guillaume 2018-6-20
find([obj.a] == 3)
This assumes that a is scalar for all elements of array obj.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Construct and Work with Object Arrays 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by