How to write excel-file correctly?

Hello, i'm attempting to create an excel-file which contains the information of a cell array i created.
sheet = 1;
xlRange = lot;
A=chain;
xlswrite(filename,A,sheet,xlRange)
It's possible to open the file, the aimed cells are highlighted but empty. Also i dont get back a 1 or 0 as a status for the writing operation. Does anyone have a clue how to fix this? (The cell array 'chain' is not empty.)
Thanks in advance.

3 Kommentare

Jan
Jan am 9 Okt. 2017
Bearbeitet: Jan am 9 Okt. 2017
Please post the contents of A. Perhaps it is a cell of cell strings? What is "lot"? Perhaps you have written to cells far apart from the location where you expect them?
xlswrite answers the status, if you catch the output:
status = xlswrite(...)
Please post some code, which allows to reproduce the problem.
>> lot
lot =
B2
>> A
A =
{1x1 cell} {1x1 cell} {1x1 cell}
>> A{:,:}
ans =
'ABC'
ans =
'DEF'
ans =
'GHI'
laboratoryassist
laboratoryassist am 9 Okt. 2017
The problem seems to be that the content of A are cell arrays themselves. Fixed it. Thanks for the impulses.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 9 Okt. 2017

0 Stimmen

The problem was solved in the comments already. Now as an answer:
A =
{1x1 cell} {1x1 cell} {1x1 cell}
The contents of A must be strings or scalar numbers:
A = {'hello', 9}
Providing a cell of cells does not work. What a pity, that XLSWRITE does not provide a meaningful error message.

Gefragt:

am 9 Okt. 2017

Beantwortet:

Jan
am 9 Okt. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by