access properties from an array of objects as an array?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Guillaume
le 20 Juin 2018
find([obj.a] == 3)
This assumes that a is scalar for all elements of array obj.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Construct and Work with Object Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!