access different properties of object via variable name

1 vue (au cours des 30 derniers jours)
Mahdi
Mahdi le 8 Juil 2016
Commenté : per isakson le 8 Juil 2016
Hello everybody,
I made a class 'Myobjects' with two objects 'Pilot' and 'Aircraft' with different properties. Through a function I want to change some properties of these objects. Imagine the I have for instance 2 aircraft and four pilots:
output=function(object's name) % i.e. pilot or aircraft
for i=1:length(Myobjects.object's name)
X(i)=Myobjects.[object's name '(' num2str(i) ')'].direction
end
unfortunately, it doesn't work! Does anyone have any idea!!
  1 commentaire
per isakson
per isakson le 8 Juil 2016
Is "function" the name of a method? No, I don't understand?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Software Development Tools 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!

Translated by