I have a class called class_geometry which hold the geometric quantities of each cells in a grid. On of these quantities is the x location of each of the four corners of the cell. I then make initialize an array of these class objects (not sure if my terminology is correct). My problem is that I do not know how to initialize an array in my class def. Here is my class:
classdef class_geometry
properties
dx1;
dx2;
dx3;
dx4;
end
end
And I would like to have just dx that holds four different values:
classdef class_geometry
properties
dx;
end
end
So in the end I could do something like that:
for i = 1:IL+1
for j = 1:JL+1
cell(i,j).dx(1) = x_grid(i+1,j) - x_grid(i,j);
cell(i,j).dx(2) = x_grid(i+1,j+1) - x_grid(i+1,j);
cell(i,j).dx(3) = x_grid(i,j+1) - x_grid(i+1,j+1);
cell(i,j).dx(4) = x_grid(i,j) - x_grid(i,j+1);
end
end
Thanks for the help.