Storage many same dimension matrixes to one matrix

1 visualización (últimos 30 días)
yiying peng
yiying peng el 15 de Jun. de 2022
Comentada: yiying peng el 15 de Jun. de 2022
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]

Respuesta aceptada

Chunru
Chunru el 15 de Jun. de 2022
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

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by