【发布时间】:2013-04-20 20:06:10
【问题描述】:
我正在尝试在另一个类 Systemin MATLAB. The classCell 中创建一个类 Cell 的对象数组:
classdef Cell
properties
ID;
EntityID;
ZoneID;
NeighborID;
State;
nextChangeTime;
end
methods
% Define the constructor
function obj = Cell()
obj.ID = zeros(1);
obj.EntityID = zeros(1);
obj.ZoneID = zeros(1);
obj.NeighborID = zeros(1);
obj.State = zeros(1);
obj.nextChangeTime = zeros(1);
end
end
现在我有另一堂课System。我尝试制作一个 Cell 对象数组,如下所示:
classdef System
properties
Cells;
end
methods
function obj = System(dimx,dimy)
obj.Cells(dimx,dimy) = Cell();
end
end
但我认为我使用了错误的格式。不确定这是否可能。任何有关如何实现此目的的建议将不胜感激。
【问题讨论】:
标签: matlab matlab-class