フィルターのクリア

saving the output matrices of for loop ?

1 回表示 (過去 30 日間)
Abdelwahab Fawzy
Abdelwahab Fawzy 2016 年 9 月 10 日
回答済み: Image Analyst 2016 年 9 月 10 日
if i have (for loop) (for i=1:r) which generate a matrix of (m,3) dimensions at each time
i want to save these matrices in only one matrix (mr,3)

採用された回答

Image Analyst
Image Analyst 2016 年 9 月 10 日
Try something like this:
m = 4; % Whatever you want.
r = 5; % Whatever you want.
% Preallocate the 3-D array
% to hold all the 2-D m-by-3 matrices.
matrix3d = zeros(m, 3, r);
for k = 1 : r
thisMatrix = rand(m, 3); % Whatever you want.
matrix3d(:, :, k) = thisMatrix;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by