Problem with xlswrite. Need to write text and numbers. Need help!!

3 ビュー (過去 30 日間)
Kokalz
Kokalz 2012 年 7 月 13 日
コメント済み: Avery Krovetz 2017 年 6 月 2 日
Good day! I've developed a gui, that takes data from an excel spreadsheet and does certain calculatons to some of the data. I then need to write the answers from the GUI into certain cells in a new excel sheet. I also need the xlswrite to give the names to those values. What i've tried so far was something similar to this:
A=[1 2 3 4];
B='test';
xlswrite('test.xls',[A B]);
the problem with that is that it for some reason creates .csv file instead of .xls and every letter of the text is in a separate column. I also have no idea how to write specific elements to specific cells. I tried specifying the cells in xlswrite,but it did not work. Any ideas or suggestions? Thank you!

採用された回答

F.
F. 2012 年 7 月 13 日
You should use a cell array where each cell contains one value : a double, a string, ... but not an array !!
So try something like this:
A = { 1, 'Test' ; 2, 0 ; 3, 0 };
xlswrite( 'toto.xls', A )
After, look command : num2cell
  1 件のコメント
Avery Krovetz
Avery Krovetz 2017 年 6 月 2 日
This doesn't seem to work anymore. I copied your code into MATLAB and received the error:
Error using dlmwrite
The input cell array cannot be converted to a matrix.
Thoughts?

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

その他の回答 (0 件)

カテゴリ

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