フィルターのクリア

xlswrite problems - example from the documentation produces an error

1 回表示 (過去 30 日間)
ULJ
ULJ 2015 年 9 月 23 日
コメント済み: Alen Alempijevic 2016 年 10 月 29 日
Suddenly xlswrite does not work anymore.
Even trying the example results in error:
filename = 'testdata.xlsx';
A = [12.7 5.02 -98 63.9 0 -.2 56];
xlswrite(filename,A)
Error using xlswrite (line 219)
I realize that this is probably not an outright matlab error, but maybe someone has seen it before. Tracing the execution the actual error is on this line:
[~, ExcelWorkbook] = openExcelWorkbook(Excel, file, readOnly);
and looking in the folder, I can see that the file was not created in the previous step.
I have MatLab 2015b and Excel is installed and working properly. I have tried to write to different folders but no luck. Could it be some kind of setting for what Excel is allowed to do? (Saving a file from Excel is of course no problem.)
I tried a previous version of MatLab, where I know that xlswrite has worked, but got the same error.
Help is appreciated.
  2 件のコメント
Jan
Jan 2015 年 9 月 24 日
What is the error message?
Alen Alempijevic
Alen Alempijevic 2016 年 10 月 29 日
Same here, Matlab 2015b, Excel 2016, fails on exact same line (just like yourself, have run example provided by Matlab).
MException with properties:
identifier: 'MATLAB:COM:E0'
message: ''
cause: {0x1 cell}
stack: [3x1 struct]
K>> exception.stack.file
C:\Program Files\MATLAB\R2015b\toolbox\matlab\iofun\private\openExcelWorkbook.m
C:\Program Files\MATLAB\R2015b\toolbox\matlab\iofun\xlswrite.m
C:\Program Files\MATLAB\R2015b\toolbox\matlab\iofun\xlswrite.m
K>> exception.stack.name
openExcelWorkbook
xlswrite/ExecuteWrite
xlswrite
K>> exception.stack.line
16
249
213

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

回答 (1 件)

BAN
BAN 2015 年 9 月 24 日
It doesn't throughout any error for me.
Try creating the file in WRITE mode. I think the file you created is in READ mode, that's why it's popping out that error.
Or try running the MATLAB in administrator mode.
  3 件のコメント
Matthew Maltese
Matthew Maltese 2016 年 1 月 23 日
I am having this EXACT same problem. I executed the following code, copied directly from MATLAB documentation:
clear;
filename = 'testdata.xlsx';
A = {'Time', 'Temperature'; 12,98; 13,99; 14,97};
sheet = 2;
xlRange = 'E1';
xlswrite(filename,A,sheet,xlRange);
and here is the error text:
Warning: Could not start Excel server for export.
XLSWRITE will attempt to write file in CSV format.
> In xlswrite (line 174)
In test (line 6)
Error using xlswrite (line 187)
An error occurred on data export in CSV format.
Error in test (line 6)
xlswrite(filename,A,sheet,xlRange);
Caused by:
Error using dlmwrite (line 112)
The input cell array cannot be converted to a
matrix.
I am running MATLAB R2015b and Excel 2011 on MAC El Capitan.
Walter Roberson
Walter Roberson 2016 年 1 月 23 日
Limitations:
If your computer does not have Excel for Windows®, or if the COM server (part of the typical installation of Excel) is unavailable, then the xlswrite function:
  • Writes array A to a text file in comma-separated value (CSV) format. A must be a numeric matrix.
  • Ignores the sheet and xlRange arguments.
----

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

カテゴリ

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