wrting a cell array of strings to excel

조회 수: 1 (최근 30일)
A K
A K 2011년 4월 11일
This is more of an Excel question than Matlab.
H1 H2 H3 H4 H5 20080 34611 ABC 123 10,21,30 20080 34612 DEF 567 1,2,5
I have a cell array called output displayed above which I write to excell from matlab via
xlswrite('opfile.xlsx', output, 'outsheetname', 'A1')
But Excel interprets the last column (an array of strings) incorrectly as it has both commas and integers and the resulting column is incorrectly displayed - even when the Excel cells are formatted as text. (The other columns are displayed correctly)
When I write the last column of output to a text file via
temp = [ output(:,5)'] ifp = fopen('outfile.txt', 'w') fprintf(ifp, '%s\n', temp{:}) fclose(ifp)
the text is written perfectly.
any ideas? Thanks

답변 (1개)

Robert Cumming
Robert Cumming 2011년 4월 11일
You could also investigate
dlmwrite
where you can specify the delimiter for importing into excel.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by