필터 지우기
필터 지우기

struct to excel data saving

조회 수: 25 (최근 30일)
Mudasser Seraj
Mudasser Seraj 2018년 2월 6일
댓글: Caoimhe Madine 2020년 4월 2일
Hi, I have a 15x3x5 struct with 12 fields. I want to save all the data inside the structure in excel with one sheet for each field. How can I do that?
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2018년 2월 6일
Your array size is 15x3x5. There is no way in Excel that can represent this three dimensional size. I would suggest you making it 225 (the number of structures) by 12 (the number of fields) array. You can write this array in one Excel sheet.

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 2월 6일
S=[Cars(:)];
writetable(struct2table(S),'test.xlsx');
winopen test.xlsx
  댓글 수: 1
Mudasser Seraj
Mudasser Seraj 2018년 2월 6일
Thank you so much. It worked well.

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

추가 답변 (1개)

Raj Sodhi
Raj Sodhi 2019년 9월 29일
I found that my struct had sub-structs and those structs had arrays within those elements. So I wrote a little better solution that might be worth sharing. See attached function.
Yours,
Raj
  댓글 수: 1
Caoimhe Madine
Caoimhe Madine 2020년 4월 2일
Would you be able to give some guidance on where in this code you input your own files and names. It is not quite clear to me

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by