多维3D细胞阵列

时间:2017-02-25 23:24:08

标签: arrays matlab cell

如何创建这个多维3D Cell数组? https://www.mathworks.com/help/matlab/math/ch_data_struct6.gif enter image description here

2 个答案:

答案 0 :(得分:0)

您链接的图像不会描绘3D Cell数组,而是描绘3D Structure数组。例如,包含第一个“患者”信息的结构可以通过以下方式构建:

patient(1,1,2).name = 'Al Smith';
patient(1,1,2).billing = 504.70;
patient(1,1,2).test = [80 80 80; 153 153 154; 181 190 183];

答案 1 :(得分:0)

我可以帮助你找第一位病人:

%Allocate 3D empty cell array (cell array dimension is 2x2x2).
patient = cell(2, 2, 2);

%Set details of first patient.
patient{1, 1, 2}.name = 'Al Smith'; %Set name field (string).
patient{1, 1, 2}.billing = 504.70;  %Set billing field (double).
patient{1, 1, 2}.test = [80, 80, 80; 153, 153, 154; 181, 190, 182]; %Set test field (3x3 matrix).

%Continue with next patient:
patient{1, 2, 2}.name = 'Dora Jones';
%...
%...