필터 지우기
필터 지우기

how to convert a 3D array into a n 2D arrays

조회 수: 1 (최근 30일)
Hugo
Hugo 2022년 2월 23일
답변: Kevin Holly 2022년 2월 23일
Hi,
I have a 3D array, called A, that is 20*1000*30.
How can I convert the matrix A into 20 2D arrays, with size 1000*30, in which each array represents (i,:,:), where i is the ID of the array.
Best regards,

채택된 답변

Kevin Holly
Kevin Holly 2022년 2월 23일
A=rand(20,1000,30);
for i = 1:20
B{i} = squeeze(A(i,:,:));
end
B
B = 1×20 cell array
{1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double}

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by