How can I transform a 3D dimension array (15*781*81) to 15 extracted 781*81 2D matrix to make it feasible to write down them in different Excel files?
Cheers,
Hiua

 채택된 답변

Walter Roberson
Walter Roberson 2019년 7월 24일

0 개 추천

result = cellfun(@squeeze, num2cell(YourArray, [2 3]), 'uniform', 0)
This will give you a 15 x 1 cell array, each entry of which is a 781 x 81 array

댓글 수: 2

Another possible way:
result = arrayfun(@(k) squeeze(YourArray(k,:,:)),1:15,'UniformOutput',false);
This will also give you the same result as Walter-san's answer.
Thanks indeed

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

추가 답변 (1개)

Stephen23
Stephen23 2019년 7월 24일

0 개 추천

"How can I transform a 3D dimension array (15*781*81) to 15 extracted 781*81 2D matrix to make it feasible to write down them in different Excel files?"
There is no point in creating a separate cell array with duplicates of all of the data.
Simply loop over the array and save it as you go:
A = your 15x781x81 array
for k = 1:size(A,1)
M = permute(A(k,:,:),[2,3,1]);
... save M here
end

댓글 수: 2

Another Solution! hanks again
Stephen23
Stephen23 2019년 7월 28일
@Hiua Daraei: you can vote for my answer too! Voting is an easy way to show your appreciation.

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

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

질문:

2019년 7월 24일

댓글:

2019년 7월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by