Is it possible to define the properties for a class using cell array?
5 ビュー (過去 30 日間)
古いコメントを表示
For example, I have a cell array AA={'x' 'y' 'z'} obtained by reading external files such as Excel table. How can I define the properties x, y, z for a class by referring to AA or a function with output AA. Is this possible?
instead of:
classdef T
properties
x
y
z
end
end
I want something like:
classdef T
properties
AA's elements
end
end
Thanks...
採用された回答
Sean de Wolski
2013 年 10 月 9 日
編集済み: Sean de Wolski
2013 年 10 月 9 日
Ycan have your class inherit from DynamicProps and this will allow you to add properties dynamically.
C = {'x','y','z'};
D = exampleDynProp; %attached
for ii = 1:numel(C);addprop(D,C{ii});end
D
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!