필터 지우기
필터 지우기

xlswrite command not working

조회 수: 25 (최근 30일)
Atinesh Singh
Atinesh Singh 2017년 7월 18일
답변: Håkon Bye 2019년 8월 13일
I am trying to export matlab data to excel file but I am getting this error
Error using xlswrite (line 219)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: The file could not be accessed.
Command I am using
xlswrite('file.xslx', [1 2 3]);
I tried reinstalling office, but It didn't work. I am using Windows 10 Pro (x64), Office 2016 (x64).

답변 (3개)

Fangjun Jiang
Fangjun Jiang 2017년 7월 18일
편집: Fangjun Jiang 2017년 7월 18일
should it be xlswrite('file. xlsx', [1 2 3])?
Sometimes when you initially had some types of file error, the file kept being open so xlswrite() can not over-write it. That is the cause for your error message.
Just delete that file completely and re-try.
  댓글 수: 2
Atinesh Singh
Atinesh Singh 2017년 7월 18일
That's minor typo, But same error persists even with extension 'xlsx'.
Fangjun Jiang
Fangjun Jiang 2017년 7월 19일
Try a different file name, for example, run this separately in Command Window and see what happens:
xlswrite('test.xlsx', [1 2 3])

댓글을 달려면 로그인하십시오.


Jan
Jan 2017년 7월 18일
The error message contains 4 ideas. Did you try them? If so, mentioning this detail would be very useful for the readers.
As Fangjun Jiang has pointed out already: ".xslx" might not be the wanted file extension. If the file is opened by another process or the folder is write protected, such an error message would be expected also.
Some strange Excel problem have been solved by this tip:
For x64 processes create the following folder:
C:\Windows\SysWOW64\config\systemprofile\Desktop
For x86 processes create the following folder:
C:\Windows\System32\config\systemprofile\Desktop
  댓글 수: 2
Atinesh Singh
Atinesh Singh 2017년 7월 18일
That's minor typo, But same error persists even with extension 'xlsx'.
Atinesh Singh
Atinesh Singh 2017년 7월 18일
The folder you mentioned is already present.

댓글을 달려면 로그인하십시오.


Håkon Bye
Håkon Bye 2019년 8월 13일
I had a similar error message. It turned out that the error occured because I had my MATLAB folder stored at a onedrive folder. I think the problem is caused by the spaces in the name of the onedrive folder.

카테고리

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