필터 지우기
필터 지우기

Large binned matrix reshape

조회 수: 1 (최근 30일)
Avik Mahata
Avik Mahata 2021년 10월 8일
댓글: Image Analyst 2021년 10월 9일
I was trying to find a similar solution to my problem, but I couldn't find any exact solution. I have a large matrix of 2000x100, similar data is binned in to 10 different matrices. Each of the bins are 2000x10.
That matrix is right now, bin1(2000x10) bin2 (2000x10) ......... bin10(2000x10).
I am trying to reshape the such a way that it will be ,
bin1 (2000x10)
bin2 (2000x10)
.
.
.
bin10. (2000x10)
So I should be ending up with a dataset of 20000x10. The bins need to be converted in the same sequence.

채택된 답변

Matt J
Matt J 2021년 10월 8일
편집: Matt J 2021년 10월 8일
tmp=num2cell(reshape(yourMatrix,200,10,10),[1,2]);
result=vertcat(tmp{:});
  댓글 수: 2
Avik Mahata
Avik Mahata 2021년 10월 9일
Thanks Matt for taking time to reply. This trick worked. Thanks a lot. Wish you a happy long weekend.
Image Analyst
Image Analyst 2021년 10월 9일
Not sure why going to a cell array, tmp, was necessary. Since you said your "data is binned in to 10 different matrices" of size 2000 x 100 (which is not large by the way) then why can't you simply combine your 10 different matrices like this:
% Vertically stack the "10 different matrices" that the user has:
allBins = vertcat(bin1, bin2, bin3, bin4, bin5, bin6, bin7, bin8, bin9, bin10);
as I suggested in my answer? Why convert each matrix into a cell array?

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

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 10월 8일
Wouldn't it just be
% Vertically stack the "10 different matrices" that the user has:
allBins = vertcat(bin1, bin2, bin3, bin4, bin5, bin6, bin7, bin8, bin9, bin10);
??? Or is that not the ordering you wanted?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by