필터 지우기
필터 지우기

Storage many same dimension matrixes to one matrix

조회 수: 1 (최근 30일)
yiying peng
yiying peng 2022년 6월 15일
댓글: yiying peng 2022년 6월 15일
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