access different properties of object via variable name
1 次查看(过去 30 天)
显示 更早的评论
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!!
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!