I have a cellarray (100000000*2cell) ,how can I save the cell in excel more quickly ?
古いコメントを表示
if i choose the fonction csvwrite(), i think that will be a long time to wait , do you have some good ideas saving it more quick? thanks
7 件のコメント
per isakson
2014 年 10 月 14 日
編集済み: per isakson
2014 年 10 月 14 日
- Why do you use a cell array in the first place?
- Does it contain a mixture of string and numerical values?
- "good ideas"   require a better description of your cell array
- "a long time to wait"   why do you think so?
pengcheng
2014 年 10 月 15 日
編集済み: per isakson
2014 年 10 月 15 日
Adam
2014 年 10 月 15 日
Does csvwrite even support cell arrays? Operations on cell arrays in general are not known for their speed so operating on a hundred million cells is likely to be slow whatever you are doing with it.
pengcheng
2014 年 10 月 15 日
Adam
2014 年 10 月 15 日
Well, even just some basic maths on that would suggest if 1 million lines take a minute then 100 million lines might take of the order of 100 minutes.
per isakson
2014 年 10 月 15 日
編集済み: per isakson
2014 年 10 月 15 日
I repeat my question: "Why do you use a cell array in the first place?".
What does
whos the_name_of_your_variable
return?
Is it important that the data is saved to a text file? Saving to a binary file is faster, e.g. with save.
Stephen23
2014 年 10 月 15 日
A cell array does seem like a pretty inefficient storage choice for this data. Why not simply in a numeric array? And for that matter, saving the data in compressed binary form (eg .mat).
採用された回答
その他の回答 (2 件)
Iain
2014 年 10 月 15 日
2 投票
Here's a better idea.
Don't save it to a text file. 100 million lines of text, of 40 bytes per line (more if nicely formatted), is a 40 * 100M = 4GB file. It is a truly immense file saved in an extremely inefficient fashion.
You have 19 significant figures. - I'm guessing these numbers are unsigned 64 bit integers? Why not write them to file as such?
This way, you only need a few hundred characters (as text, to describe the filetype [possibly even including the matlab code to read the file]) at the top, then 8 bytes per number - 16 bytes per line. 16 * 100M = 1.6GB file. It will write to disk in less than half the time, use up less space, AND be easier to read chunks of it at a time.
Orion
2014 年 10 月 14 日
0 投票
if your cell array is really a 100000000*2 cell, it is too big for Excel (maximum number of line : 2^20 = 1048576).
you should consider to write your data in a simple text file.
or if you reaaly need to write it in a xls file, you need to split your cell in smaller elements and write each "small" cell in a new sheet.
2 件のコメント
Ilham Hardy
2014 年 10 月 14 日
csvwrite doesn't create xls file. xlswrite does.
pengcheng
2014 年 10 月 15 日
カテゴリ
ヘルプ センター および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!