필터 지우기
필터 지우기

access different properties of object via variable name

조회 수: 2 (최근 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 CenterFile Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by