Excel "Open method of Workbooks class failed"

83 visualizzazioni (ultimi 30 giorni)
V.D-C
V.D-C il 28 Mag 2020
Hello,
I am working with 3 functions running in parallel with parfor, and they are supposed to give approximately 3000 output files each. The code doesn't change much between each iteration, they are basically 3 big loops.
However, they stop running after around 250 iterations and I have this error message on one of them:
Error using xlsread (line 257)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Open method of Workbooks class failed
Help File: xlmain11.chm
Help Context ID: 0
Error in read_excel2cell (line 2)
[dummy1, dummy2, result] = xlsread(filename);
I tried restarting Matlab, restarting my pc, overwriting the .xlsx files in case they were corrupted etc... But I can't get it work while the exact same code was working fine this morning.
Does anybody have a lead on what could cause this kind of issue ? I exhausted every solution I could find about it.
Have a nice day

Risposte (1)

Bhargavi Maganuru
Bhargavi Maganuru il 8 Lug 2020
Hi,
This can occur if the directory you are trying to write to does not exist, or if you don't have write access to that directory. While you can "write" to files which don't previously exist (MATLAB will create them), the directory does need to exist beforehand.
This can also happen in some situations where the user which starts the Excel is a system user. Excel expects the existence of the Desktop directory. To enable the command to work try the following:
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

Community Treasure Hunt

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

Start Hunting!

Translated by