How to use a class instance implicitly

조회 수: 12 (최근 30일)
Yucheng Fu
Yucheng Fu 2017년 2월 22일
댓글: Beder 2017년 2월 23일
In my problem, if define a class with many property items as
classdef classname
properties
ProName1
ProName2
...
ProName100
end
end
Then in my main script, I initialize an instance of this class as
para=classname
Then if pass this class variable para to another function, in order to use the terms in this class, I have to type para.ProName1, para.ProName2,....etc. Is there any way in the function, I can use the terms of para directly such as ProName1,ProName2..., without add the classname para in the function.
  댓글 수: 1
Beder
Beder 2017년 2월 23일
As far as I know, no. You can create one .m file per ProName. Then you don't need to write para.ProName2.

댓글을 달려면 로그인하십시오.

답변 (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