필터 지우기
필터 지우기

Struct Field to Matrix large dataset

조회 수: 3 (최근 30일)
Avik Mahata
Avik Mahata 2021년 10월 8일
답변: Dave B 2021년 10월 8일
I have a strucure which has a value of the field, 20000x5x100, what it means that it has a set of 100 matrices which has, 20000 rows and 5 columns. How do I convert it to a 2000000x5 matrix printing all the 100 sets in the sequence it has been saved in the structure?

채택된 답변

Dave B
Dave B 2021년 10월 8일
You can use reshape but you may wish to use permute first to get things in the right order:
a=cat(3,[1 2;3 4],[5 6; 7 8])
a =
a(:,:,1) = 1 2 3 4 a(:,:,2) = 5 6 7 8
reshape(permute(a,[1 3 2]),[],2)
ans = 4×2
1 2 3 4 5 6 7 8

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by