Is {} used as index array in class?
Mostrar comentarios más antiguos
Hi, While I am studying Matlab object oriented I found this example and I want to confirm it.
I have a constructor:
function obj = DocPortfolio(name,varargin)
if nargin > 0
obj.name = name;
for k = 1:length(varargin)
obj.indAssets{k} = varargin(k);
assetValue = obj.indAssets{k}{1}.currentValue;
obj.totalValue = obj.totalValue + assetValue;
end
end
end
indAssets is an array property. Is it true that obj.indAssets{k} is a way to index into this array? Cause I have never use {} to index array before. And what is obj.indAssets{k}{1} in next line?
This is the link to the example: http://www.mathworks.com/help/matlab/matlab_oop/a-simple-class-hierarchy.html
Thanks!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Functions en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!