Convert struct with several fields into long table

조회 수: 15 (최근 30일)
Aleya Marzuki
Aleya Marzuki 2020년 11월 3일
댓글: Ameer Hamza 2020년 11월 3일
I have a structure (see image) with 9 fields and 100 rows. Each row is a 200x1 double. As each row has exactly the same dimensions, I was wondering if there was a function I could use to open up the rows to make a long table with 20000 rows?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 3일
Try this
T = array2table(cell2mat(squeeze(struct2cell(trai)).'), 'VariableNames', fieldnames(trai))
  댓글 수: 2
Aleya Marzuki
Aleya Marzuki 2020년 11월 3일
worked perfectly, thank you!
Ameer Hamza
Ameer Hamza 2020년 11월 3일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by