How to create arrays for 3D matrix?

13 次查看(过去 30 天)
Hello
I created an array in order to put the results into it. Meanwhile, my matrix is 3D.
The 3D matrix is:
[4,3,2]=size(S)
And the created array is:
Result=[];
Is that a true definition?
Cheers
  1 个评论
dbmn
dbmn 2016-8-18
In general preallocation of matrices is not necessary in Matlab (it does increase speed, but is not necessary).
Just fill your matrix with the data and you should be fine. If you want to preallocate, use the solution that Siva showed. Zeros instead of rand might be an even better way.

请先登录,再进行评论。

采纳的回答

KSSV
KSSV 2016-8-18
k = rand(4,3,2) ; % create random 3d data
[m,n,p] = size(k) ; % get size

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by