access different properties of object via variable name

1 回表示 (過去 30 日間)
Mahdi
Mahdi 2016 年 7 月 8 日
コメント済み: per isakson 2016 年 7 月 8 日
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 件のコメント
per isakson
per isakson 2016 年 7 月 8 日
Is "function" the name of a method? No, I don't understand?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by