Appropriate way to store 3d matrix ?

20 visualizaciones (últimos 30 días)
Teerapong Poltue
Teerapong Poltue el 18 de En. de 2021
Editada: Teerapong Poltue el 19 de En. de 2021
I'm using
unitcellsize = 1:0.01:1.01;
num = max(size(unitcellsize));
for jj = 1:num
a{jj} = -unitcellsize(jj)/2:0.04:unitcellsize(jj)/2;
b{jj} = -unitcellsize(jj)/2:0.04:unitcellsize(jj)/2;
c{jj} = -unitcellsize(jj)/2:0.04:unitcellsize(jj)/2;
[X{jj},Y{jj},Z{jj}] = meshgrid(a,b,c);
end
Is this an appropriate way to store 3d matrix. I would like to store 3d matrix __x__x__.
If this is the appreciate way, how can I recall 3d matrix for using ?
  1 comentario
Bob Thompson
Bob Thompson el 18 de En. de 2021
A 3D matrix is created, and data stored, simply by calling out a third dimension:
A = randi(100, 5, 4, 10); % Creates random integer matrix of size 5x4x10
This format works for pretty much any multidimesional matrix generation command (zeros, ones, rand), and assigning specific values just means calling out a third dimensional index value.
A(1,1,1) = 100; % Set first value to 100
A(:,1,1) = 100; % Set first column, first sheet to 100
I'm not sure how this applies to your data though, because all of the variables you've specified seem to just be row matricies, at first glance. Do you have a piece of information you want to assign to every index in a 3D matrix that isn't shown here?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by