Export Data from a Structure which contains double timeseries data to Excel ... Example Data Provided...

조회 수: 12 (최근 30일)
Hello,
I have:
Struct named 'CarData', contains double timeseries fields, named 'Left' and 'Right' each has with 20 columns and over 10-20,000 rows.
I wish to run a script to export CarData.Left into an new Excel sheet (xlswrite('something.xlsx'), I've read various pages of help and am struggling to address the data fields inside as well as extracting all 20 columns.
Can someone please facilitate, having the field names if of no importance. I only need the numerical data without concatenating vertically/horizontally.
Here are some of the pages I've looked into: https://uk.mathworks.com/matlabcentral/answers/278751-how-to-extract-data-from-structure-efficiently https://uk.mathworks.com/matlabcentral/fileexchange/22510-struc2xls https://stackoverflow.com/questions/25948371/how-to-write-a-structure-to-excel-in-matlab struct2cell etc
I'm in need to do with without the use of plug-ins, I've attached an example version of the MATLAB struc to help understand what I have.

채택된 답변

Cedric
Cedric 2017년 10월 17일
편집: Cedric 2017년 10월 17일
Here is one way if you want to create two worksheets "Left" and "Right" in the same workbook, with 21 column per sheet for time and data:
xlswrite( 'CarData.xlsx', [CarData.Left.Time, CarData.Left.Data], 'Left' ) ;
xlswrite( 'CarData.xlsx', [CarData.Right.Time, CarData.Right.Data], 'Right' ) ;
  댓글 수: 4
Ilaria Shireen Sestili
Ilaria Shireen Sestili 2020년 7월 29일
Hello,
I have tried as said but exporting them to excel I obtain many inconsistencies with the data, meaning that excel doesn't read the . separator and I get in some cells 1227 instead of 12.27 for example,but not in all of them.
does anyone now how to solve this problem?
thanks a lot!
Cedric
Cedric 2020년 7월 29일
There are new functions for exporting data to file, like writematrix, writecell, writetable, or writetimetable.
If these fail, could you attach a slice of your data to your question/comment?

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

추가 답변 (0개)

카테고리

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