How can I speed up "writetable" for large tables?

조회 수: 26 (최근 30일)
Elvira123
Elvira123 2019년 1월 22일
답변: Jeremy Hughes 2019년 1월 23일
I need to write a huge table (around 5000000x50) on an excel file. For now, I'm using "writetable", but it takes a lot of time (20-30 minutes). How can i speed up the process by considering that the table has both strings and numbers and the type of element in the table can change each time?
Thank you

답변 (2개)

Jan
Jan 2019년 1월 22일
Total number of rows and columns on a worksheet: 1,048,576 rows by 16,384 columns
This should mean, that 5'000'000 exceeds the maximum number of rows. So if the creation of the table takes 20-30 min, I'm surprised, that it works at all. Please check this. If it does not write the data completely, there is no reason to increase the speed.
  댓글 수: 4
Elvira123
Elvira123 2019년 1월 23일
Effectively, I split results on various excel files, but I want to speed up the process.
Walter Roberson
Walter Roberson 2019년 1월 23일
If you have MS Windows with Excel installed, experiment with disabling (uninstalling) Excel. That will trigger writetable() to use internal routines that are different speed than going through the interface to Excel.
Note that .xslx files are fundamentally a zip'd directory of xml text files, so writing a lot of data takes time to write and time to internally zip afterwards.

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


Jeremy Hughes
Jeremy Hughes 2019년 1월 23일
As a more programatic solution based on Walter's suggestion: If you're in a recent release (I think 18b), you can provide the 'UseExcel' parameter to disable communication with the Excel process. This generally speeds up writing since Excel likes to inspect the data and "do things" like evaluate formulas and try to convert text to dates as you write the data.
In general, I wouldn't suggest Excel for storing large datasets, but that really depends on what you're doing with them and what data you have.
Without any more context, my reccomendation would be to use CSV. It can be read by Excel, and a lot of other software as well.

카테고리

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