MATLAB: Do I get an error when using XLSREAD in a BATCH job submitted to a Windows cluster managed by MathWorks Job Scheduler in MATLAB Distributed Computing Server 6.0 (R2012a)

http://troyvssharepoint.blogspot.nl/2012/07/stumbled-upon-interesting-one-today.htmlMATLAB Parallel Server

I am using a Windows cluster managed by MathWorks Job Scheduler.
I have a 'xlsReadTest.m' file is a script that contains a call to XLSREAD as follows:
[numData,textData,rawData] = xlsread('Test_SR.xlsx');
numProc = numel(numData);
results = NaN(size(numData));
parfor loopProc = 1:numProc
results(loopProc) = numData(loopProc) + 20;
end
When I run the 'xlsReadTest.m' script as a batch job with the following command:
batch(schedObj,'xlsReadTest','Matlabpool',31,'FileDependencies', {'xlsReadTest.m','Test.xlsx'});
I obtain the following error message: ERROR: ErrorIdentifier: MATLAB:COM:E2148140012 ErrorMessage: Invoke Error, Dispatch Exception: : Source: Microsoft Office Excel : Description: Microsoft Office Excel cannot access the file '..\..\Test.xlxs'.
If I use XLSREAD in basic mode, I am able to read the data.

Best Answer

  • Note that XLSREAD makes use of Excel's COM Automation Server. Further, MDCS Workers typically run under the SYSTEM account on Windows systems. Unfortunately, Excel's COM Automation Server by default does not work well when called from a process running under the SYSTEM account. There are two things which you may need to configure for Excel's COM Server to work well:
    1. Excel requires the profile of the user account under which it runs to have a "Desktop" directory. The SYSTEM account does not have this by default and you will need to manually create it. If working with 32-bit Excel, create:
    c:\Windows\SysWOW64\config\systemprofile\Desktop
    If working with 64-bit Excel, create:
    C:\Windows\System32\config\systemprofile\Desktop
    2. Depending on your Excel version you may also need to configure the COM security settings correctly:
    a. Navigation to Adminstrative Tools->Component Services->MyComputer->DCOM->Microsoft Excel Application
    b. Right Click on Microsoft Excel Application and select Properties
    c. Click the Security tab
    d. Change Launch and Activation Permissions to Customize
    e. Click Edit
    f.  Add SYSTEM
    g. Check Local Launch and Local Activation