xlswrite fails when run from Task Scheduler
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
I have a routine that creates an Excel spreadsheet that I want to run every day from the Microsoft Task Scheduler. When I execute directly from MATLAB, or from a Microsoft shortcut, the routine works without error, however, fails when I use the Task Scheduler.
The MATLAB version is R2014b and the Windows version is Windows 7, Windows Server 2008 R2.
Here is sample write.
    if (strncmp(cosMGD, 'No Data', 7) == 0)
        xx = cosMGD(1,2:30);
        xlswrite ('WPQO/Toolbox/Short Term Plan Report.xlsx', xx',...
            'schedule', 'C5:C33');  
    else
        disp 'COS Actuals Production Schedule data NOT Available';
    end;
I get the following error messages when I execute from the Task Scheduler. MATLAB hangs up.
Error using <a href="matlab:matlab.internal.language.introspective.errorDocCallback('xlswrite', 'C:\Program Files\MATLAB\R2014b\toolbox\matlab\iofun\xlswrite.m', 219)" style="font-weight:bold">xlswrite</a> (<a href="matlab: opentoline('C:\Program Files\MATLAB\R2014b\toolbox\matlab\iofun\xlswrite.m',219,0)">line 219</a>)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Microsoft Excel cannot access the file
'C:\Users\emainc\Documents\MATLAB\WPQO\Toolbox\Short
Term Plan Report.xlsx'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
Help File: xlmain11.chm
Help Context ID: 0
Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('shortTermPlanReport', 'C:\Users\emainc\Documents\MATLAB\WPQO\Toolbox\shortTermPlanReport.m', 169)" style="font-weight:bold">shortTermPlanReport</a> (<a href="matlab: opentoline('C:\Users\emainc\Documents\MATLAB\WPQO\Toolbox\shortTermPlanReport.m',169,0)">line 169</a>)
        xlswrite ('WPQO/Toolbox/Short Term Plan
        Report.xlsx', xx',...
Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('daily_report', 'C:\Users\emainc\Documents\MATLAB\WPQO\daily_report.m', 46)" style="font-weight:bold">daily_report</a> (<a href="matlab: opentoline('C:\Users\emainc\Documents\MATLAB\WPQO\daily_report.m',46,0)">line 46</a>)
shortTermPlanReport(refDate);   % Short Term Plan Report
The Task Scheduler parameters are as follows:
Name: Matlab WPQO Short Term Daily Report
Description: Water Production Quality Optimizer (WPQO) – Short Term Daily Report
Trigger: Daily at 6:30 AM every day
Program/Script: "C:\Program Files\MATLAB\R2014b\bin\matlab.exe"
Add arguments: -logfile "C:\Data\LOGFILE\ReportLog.txt" -r "daily_report; exit"
댓글 수: 4
  Daryl
    
 2017년 11월 15일
				Seems to be some strange problem unrelated to MATLAB ... http://justgeeks.blogspot.com.au/2012/10/troubleshooting-microsoft-excel-cannot.html
  Victor Villar
 2019년 5월 24일
				
      편집: Walter Roberson
      
      
 2019년 5월 24일
  
			
		답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



