array of objects
Afficher commentaires plus anciens
Hi, have a class like this
classdef someClass
properties
name
value
end
methods
function obj = someClass(name)
obj.name(name)
end
end
I would like to create an array of objects of that class. So if I have the names= ('a','b','c') I would like to have an array a of 3 objects with a(1).name='a' a(2).name='b' a(3).name='c'
how do I have to structure my constructor to achieve this by calling
a(1:numel(names))=someClass(names)
or how can I do this in another halfway smart way. Thanks, C
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!