フィルターのクリア

Need to write cell array with double and char string to excel

6 ビュー (過去 30 日間)
Franco
Franco 2014 年 2 月 17 日
編集済み: Image Analyst 2014 年 2 月 18 日
I have a cell array where the first row is a string of characters identifying the information underneath and the rest of the rows are the numerical values.
A{1,:} = {'Year','Month','Day','Hour','Weekday','kW'}
A{2,:} = {2012,1,23,0.15,2,179}
Im trying to use xlswrite to write the cell array to an excel file. Turns out that Matlab doesn't like this. The error I get is "The input cell array cannot be converted to a matrix" . Anyone out there know of a work around to write my multi-type cell array to excel?

回答 (1 件)

Image Analyst
Image Analyst 2014 年 2 月 18 日
Try this, using parentheses instead of braces:
A(1,:) = {'Year','Month','Day','Hour','Weekday','kW'}
A(2,:) = {2012,1,23,0.15,2,179}
xlswrite('text.xlsx', A);
  2 件のコメント
Franco
Franco 2014 年 2 月 18 日
Tried that...doesnt work.
Image Analyst
Image Analyst 2014 年 2 月 18 日
編集済み: Image Analyst 2014 年 2 月 18 日
What are you expecting? I tried it and it does work . No errors at all. It puts each word into one Excel cell. The words in the top row, and the numbers into the second row. Exactly what were you hoping for?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by