Appropriate way to store 3d matrix ?

23 ビュー (過去 30 日間)
Teerapong Poltue
Teerapong Poltue 2021 年 1 月 18 日
編集済み: Teerapong Poltue 2021 年 1 月 19 日
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 件のコメント
Bob Thompson
Bob Thompson 2021 年 1 月 18 日
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?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by