I have a script that emails out two reports. Windows 10 Task Scheduler runs the script at set times of day.
The Pseudo code is as follows;
- Get data
- Do calculations
- Populate excel template 1 spreadsheet using - 'xlswrite'
- Create PDF using - 'xls2pdf'
- Plot Data using - 'plot'
- Insert plotted figure onto excel template 2 spreadsheet using - 'xlsputimage'
- Create PDF using - 'xls2pdf'
- Attach pdfs to email and send.
I have MATLAB set up on a virtual machine running Windows 10 on a server, which I acces via Remote Desktop.
On the Virtual Machine I have set up a task in Task Scheduler to run my script at the specified times. This all works fine.
When I am logged into the virtual machine (with Remote desktop) the script produces a perfect report when a) I run it in MATLAB, or b) if the task scheduler runs the script (while I'm logged in).
My issue is that when I am not logged into the virtual machine, both reports are not positioned correctly on the pdf. The first report where i have input arrays onto an excel template 1, the print area has become smaller, such that page 2 headings are printed on page 1. While, the second report the figure is enlarged and the edges are cut off.
I am not getting any errors from the script, just a rubbish report.
Any help will be much appreciated.