Error using xlswrite (line 226)

5 Ansichten (letzte 30 Tage)
Emanuele
Emanuele am 27 Okt. 2019
Kommentiert: Emanuele am 27 Okt. 2019
Hi All,
I'm trying to use xlswrite but I received this message:
"Error using xlswrite (line 226) Invoke Error, Dispatch Exception: Source: Microsoft Excel Description: Microsoft Excel cannot access the file 'C:\Program FilesC:\Program Files\MATLAB\R2017a\bin\9DDE4000"
What is very strange is that instead xlsread work for the same file. I have no idea of reason. My Office release is 2019 and is activated.
Thank you in advance. Any suggests is very appreciated.
Emanuele
  4 Kommentare
dpb
dpb am 27 Okt. 2019
'C:\Program FilesC:\Program Files\MATLAB\R2017a\bin\9DDE4000"
looks funky -- the "C:\Program Files" is duplicated. I'd first suspect your code building the file name has a problem.
Secondly, use Task Manager and make sure there are no zombie copies of Excel still hanging around that didn't close successfully after an earlier failed attempt. I've had that happen innumerable times while messing around w/ COM and having made a typo that caused an internal failure--the cleanup code apparently can't always fix up everything.
Alternatively, closing and restarting MATLAB will get rid of any such instances as well, but until the filename issue is resolved I think you'll continue to have issues...at least that's what the crystal ball is reading.
Emanuele
Emanuele am 27 Okt. 2019
Thanks All
I solved.
For dpb, yes you are right but it's only an error in copy error message.
The problem was that xlswrite don't find the right directory of file.
so I specify in this way
filename = 'C:\Users\Pc\Documents\MATLAB\TEST.xlsx';
and all work fine.
What made me go crazy is that instead xlsread work without specify directory. I don't know the reason of this different behavior but now work.
Thanks again.
Emanuele

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by