フィルターのクリア

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
  1 件のコメント
yiying peng
yiying peng 2022 年 6 月 15 日
thanks a lot.try not to use eval

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by