xlswrite to import data from cell array

Hello,
I have a matrix 'm' with 373 cell. each containting 2-d matrix of different size. I want to use 'xlswrite' to write the contents of each table on different sheets of the same file. Can someone please help me in this regard?

2 comentarios

Walter Roberson
Walter Roberson el 25 de Mayo de 2018
Is there a particular reason you are not using writetable() to write those tables? You can pass 'Sheetname' to writetable()
Mudasser Seraj
Mudasser Seraj el 25 de Mayo de 2018
Editada: Mudasser Seraj el 25 de Mayo de 2018
No, there's no particular reason. If I want to use writetable(), then what should be the code? Is it possible to write them as a sequence of sheets?

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Mayo de 2018
filename = 'MySpreadsheet.xls';
for sheet = 1 : length(m)
writetable(m{sheet}, filename, 'sheet', sheet)'
end

3 comentarios

Mudasser Seraj
Mudasser Seraj el 25 de Mayo de 2018
I am getting this error after a while:
"Error using writetable (line 124)
Unable to write to file 'MyDatabase.xlsx'. You may not have write permissions or the file may be open by another application."
Walter Roberson
Walter Roberson el 26 de Mayo de 2018
The first thing I would try would be to add a pause(5) after the writetable() to give the previous action time to finish.
Mudasser Seraj
Mudasser Seraj el 28 de Mayo de 2018
Yeah. That worked perfectly. Thank you so much.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 25 de Mayo de 2018

Comentada:

el 28 de Mayo de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by