access properties from an array of objects as an array?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Brian
am 20 Jun. 2018
Kommentiert: Stephen23
am 21 Jun. 2018
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 Kommentare
Akzeptierte Antwort
Guillaume
am 20 Jun. 2018
find([obj.a] == 3)
This assumes that a is scalar for all elements of array obj.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Construct and Work with Object Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!