How to create a 3D matrix in Octave
In order to create a X*Y*Z-sized 3D matrix in Octave, use
create_3d_matrix_example.m
A = zeros(X, Y, Z);For example, to create a 5x6x3 matrix, use
create_3d_matrix_example.m
A = zeros(5, 6, 3);zeros() initializes the matrix to 0:
create_3d_matrix_output.txt
>> A = zeros(5, 6, 3);
>> A
A =
ans(:,:,1) =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
ans(:,:,2) =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
ans(:,:,3) =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0Check out similar posts by category:
Octave
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow