I have a cellarray (100000000*2cell) ,how can I save the cell in excel more quickly ?
Mostrar comentarios más antiguos
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 comentarios
per isakson
el 14 de Oct. de 2014
Editada: per isakson
el 14 de Oct. de 2014
- 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
el 15 de Oct. de 2014
Editada: per isakson
el 15 de Oct. de 2014
Adam
el 15 de Oct. de 2014
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
el 15 de Oct. de 2014
Adam
el 15 de Oct. de 2014
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
el 15 de Oct. de 2014
Editada: per isakson
el 15 de Oct. de 2014
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
el 15 de Oct. de 2014
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).
Respuesta aceptada
Más respuestas (2)
Iain
el 15 de Oct. de 2014
2 votos
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.
1 comentario
pengcheng
el 15 de Oct. de 2014
Orion
el 14 de Oct. de 2014
0 votos
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 comentarios
Ilham Hardy
el 14 de Oct. de 2014
csvwrite doesn't create xls file. xlswrite does.
pengcheng
el 15 de Oct. de 2014
Categorías
Más información sobre Text Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!