exporting from cell to excel

4 次查看(过去 30 天)
Wassim Dbouk
Wassim Dbouk 2011-4-20
编辑: TED MOSBY 2024-11-18,19:48
hi I have a 32000x24 cell array. Whenever I try to export it to excel (using xlswrite) or to csv (using cell2csv) it takes ages as matlab displays a busy signal. Any tip about how to export this file to excel?

回答(1 个)

TED MOSBY
TED MOSBY 2024-10-16
编辑:TED MOSBY 2024-11-18,19:48
  • Usewritematrixorwritecell:If using a recent version of MATLAB (R2019a or later), try usingwritematrixorwritecellinstead ofxlswrite. These functions are generally faster and more efficient for writing data to files.
% Assuming your data is stored in a variable named 'data'
writecell(data, 'output.xlsx');
  • Split the Data:If possible, split your data into smaller chunks and write them individually.
  • Save as CSV:If Excel format is not a strict requirement, saving as a CSV file can be faster. You can usewritecellorwritematrixfor this purpose:
writecell(data, 'output.csv');
  • Increase MATLAB's Java Heap Memory:If you're running into memory issues, you might consider increasing the Java heap memory in MATLAB. You can do this by going toPreferences > MATLAB > General > Java Heap Memory.
  • Use Parallel Computing:If you have the Parallel Computing Toolbox, you could try to parallelize the export process. This might not be always faster.
Here is the documentation for writeCell and writeMatrix :
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by