필터 지우기
필터 지우기

Sort elements from multidimensional array into 2D array?

조회 수: 1 (최근 30일)
James Kosiol
James Kosiol 2022년 6월 9일
댓글: Abhijit Nayak 2022년 6월 9일
So I have a Multidimensional array S (115 x 90 x 64) and I need to form multple 64x1 arrays B. So for example, the first B is the first element in the 64 115x90 S array S(1,1,:). How would I go about doing this?
  댓글 수: 3
James Kosiol
James Kosiol 2022년 6월 9일
Sorry for the confusion, what im trying to achieve is basically this:
i = 1:64
B1 = S(1,1,i)
B2 = S(2,1,i)
B3 = S(3,1,i)
.
.
.
Bn = S(115,90,i)
resulting in many B 64x1 arrays
Abhijit Nayak
Abhijit Nayak 2022년 6월 9일
So, we need a way to extract the 2D matrix along z-axis and then save them separately.
Refer the following link for similar query and you can follow up the solution provided there.
Instead of saving it in different .csv files, you can store them simply in a 2D array.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2022년 6월 9일
S = rand(115, 90, 64) ;
B = squeeze(S(:,1,:)) ;
whos B
Name Size Bytes Class Attributes B 115x64 58880 double
  댓글 수: 3
KSSV
KSSV 2022년 6월 9일
S = rand(115, 90, 64) ;
iwant = cell(115,90) ;
for i = 1:115
for j = 1:90
iwant{i,j} = squeeze(S(i,j,:)) ;
end
end
James Kosiol
James Kosiol 2022년 6월 9일
yep that's done it, cheers

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by