MATLAB Answers

How can I convert a large .mat file (> 400 MB) into an excel file or csv file?

Karl-Heinz Fleischer 님이 질문을 제출함. 31 May 2011
How can I convert a large .mat file (> 400 MB) into an excel file or csv file?

  댓글 수: 3

What kind of data is in the file? How do you want it formatted?
Try being a little more precise.
it is a large log file from a simulink "to workspace" block.
The command xlswrite brings up cache errors.
the file is for example <24x2107089 double> big.
:)
have you considered splitting it up into several files, then joining them via another program?

로그인 to comment.

답변 수: 3

Andreas Goser 님의 답변 31 May 2011

It looks like you have the code already, but are looking for suggestions how to avoid memory errors. I have two:
1. Convert to SINGLE or other memory saving data type.
2. Use decimation of data, e.g. take only every 2nd, 10th, etc. data point.
I often observe that users create more data than they really need just "because it is possible". I can't assess your project, but this is a general observation.
If you have control over the Simulink model, you can apply those steps even within Simulink for double benefits.
There was a suggestion about splitting up the file - in this case doing it for all 24 channels can be good.
Just to make sure: You have 64 Bit MATLAB on a 64 system?

  댓글 수: 0

로그인 to comment.


Todd Flanagan 님의 답변 31 May 2011

You are probably getting this error:
??? Error using ==> xlswrite at 211
Excel returned: Error: Object returned error code: 0x800A03EC.
This comes from the Excel activex interface. The best approach to work around this is to write your worksheet in chunks in a loop. There is an example of that here.

  댓글 수: 0

로그인 to comment.


Fangjun Jiang 님의 답변 31 May 2011

There is a limit on the number of rows and columns in an Excel file. 65536 rows and 256 columns for MS Office 2003. 1,048,576 rows by 16,384 columns for Office 2007. Transpose your matrix and try csvwrite(). If not working, try to use fopen(), fprintf() to write your matrix one line at a time. Sounds like you need to write more then 2 million times.

  댓글 수: 0

로그인 to comment.



Translated by