Write out a cell whith characters and numbers to excel
4 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I create a 1 x 4 cell where:
col 1 = 23 x 20 char (i.e. dates and times)
col 2 = 23 x 1 double (data)
col 3 = 23 x 1 double (data)
col 4 = 23 x 1 double (data)
When I try to write this out to an excel file, I get the error message: Error using xlswrite (line 219) ActiveX - Element of a cell array cannot be a character matrix.
Even if I create a 1 x 4 cell where all 4 columns are type 'char' (I used num2str on the data), I receive the same message when I try to write out the cell to excel.
IdxAbsTilt = AbsTilt>50;
DateBad=datestr(Date(IdxAbsTilt));
BadDataCell{1,1} = DateBad;
BadDataCell{1,2} = num2str(Spd(IdxAbsTilt));
BadDataCell{1,3} = num2str(Dir(IdxAbsTilt));
BadDataCell{1,4} = num2str(AbsTilt(IdxAbsTilt));
xlswrite('BadData.xlsx',BadDataCell) % this does not work;
How do I write out my cell to excel?
0 件のコメント
採用された回答
Guillaume
2016 年 1 月 20 日
編集済み: Guillaume
2016 年 1 月 20 日
xlswrite only works with cell arrays that contain scalar numeric or string vectors. My guess is that you want end up with 23 rows in your excel spreadsheet. For that, you need to generate a 23x4 cell array:
GoodDataCell = [cellstr(datestr(Date(IdxAbsTilt))), ...
num2cell(Spd(IdxAbsTilt)), ...
num2cell(Dir(IdxAbsTilt)), ...
num2cell(AbsTilt(IdxAbsTilt))];
should do it
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!