Storage many same dimension matrixes to one matrix

1 次查看(过去 30 天)
if x1 x2 x3 all 4x4 matrix
i want storage them easy to k=[x1 x2 x3] and i have k matrix 4x12
but when n is larger to 100000
for i = 1:100000
eval( ['x', num2str(i), '=ifft2(randi([0 15],4,4));'] );
end
i use above code to generate 100000 matrixs all matrix are in 4x4 dimension
how can i stoage x1 x2 ... x100000 to a matrix k,k matrix dimesion is 4x400000
any method to do
k=[x1 x2 x3 x4 x5 ........ x100000]

采纳的回答

Chunru
Chunru 2022-6-15
Try to avoid eval. Use N-D array or cell array instead.
n=10; %100000
x = zeros(4, 4, n);
for i = 1:n
x(:,:,i) = ifft2(randi([0 15], 4, 4));
end

更多回答(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