How to use a class instance implicitly

12 vues (au cours des 30 derniers jours)
Yucheng Fu
Yucheng Fu le 22 Fév 2017
Commenté : Beder le 23 Fév 2017
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 commentaire
Beder
Beder le 23 Fév 2017
As far as I know, no. You can create one .m file per ProName. Then you don't need to write para.ProName2.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Construct and Work with Object Arrays 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