I've got a script that runs every day via Windows Task Scheduler. Part of the script uses griddata to interpolate a matrix from a uneven scattered grid to a grid specified by meshgrid. There are occasionally duplicate x-y points in the uneven grid, and this is unavoidable. When I run the program manually, I get a simple warning message, "Warning: Duplicate x-y data points detected: using average of the z values." and the program continues. When I run from Task Scheduler, I get the following error message in the logfile:
{Warning: Duplicate x-y data points detected: using average of the z values.} {> In <matlab: opentoline('C:\Program Files\MATLAB\R2011b\toolbox \matlab\polyfun\griddata.m',99,1) griddata at 99> In <matlab: opentoline('C:\modis\Step1_Interpolation.m',395, 1) Step1_Interpolation at 395> In <matlab: opentoline('C:\Program Files\MATLAB\R2011b\toolbox\ matlab\lang\run.m',57,1) run at 57> In <matlab: opentoline('C:\modis\Step0_Download_and_Main_ Process.m',140,1) Step0_Download_and_Main_Process at 140>} {Error using <matlab:helpUtils.errorDocCallback('griddata', 'C:\ Program Files\MATLAB\R2011b\toolbox\matlab\polyfun\griddata.m', 112)" style ="font-weight:bold griddata> (<matlab: opentoline('C:\Program Files\MATLAB\R2011b\toolbox\matlab\polyfun\griddata.m',112,0) line 112>)Not enough unique sample points specified.Error in <matlab:helpUtils.errorDocCallback('Step1_ Interpolation', 'C:\modis\Step1_Interpolation.m', 395)" style="font-weight:bold Step1_Interpolation> (<matlab: opentoline('C:\modis\Step1_Interpolation.m',395,0) line 395>)U = griddata(LonU,LatU,U,LonGrid,LatGrid);Error in <matlab:helpUtils.errorDocCallback('run', 'C:\Program Files\MATLAB\R2011b\toolbox\matlab\lang\run.m', 57)" style="font-weight: bold run> (<matlab:opentoline('C:\Program Files\MATLAB\R2011b \toolbox\matlab\lang\run.m',57,0) line 57>) evalin('caller', [s ';']);Error in <matlab:helpUtils.errorDocCallback('Step0_Download_and_Main _Process', 'C:\modis\Step0_Download_and_Main_Process.m', 140)" style="font-weight:bold Step0_Download_and_Main_Process> (<matlab: opentoline('C:\modis\Step0_Download_and_Main_Process.m',140,0) line 140>) run('C:\modis\Step1_Interpolation.m')}
And the program quits. I had a similar problem before trying to run urlread in a MATLAB script run from Task Scheduler. I eventually solved the problem by adding "status" as an output variable, which supressed the output of error messages. Since the problem seems to be connected to error and warning messages, I can only guess that supressing them leads to a solution. But is there a better way? I admit that I'm not too familiar with this area of MATLAB. Can someone explain why this is happening and how I can fix it? Thanks!
If it helps, here is the initialization parameters used in Task Scheduler:
Program Script: "C:\Program Files\MATLAB\R2011b\bin\win64\MATLAB.exe"
Arguments: -r Step0_Download_and_Main_Process;quit -logfile "C:\modis\Main_Logfile.txt"
Start In: C:\modis
Best Answer