MATLAB Answers

Brian
1

Scheduling a Matlab Script

Brian
さんによって質問されました 2012 年 5 月 23 日
I am attempting to schedule a Matlab job each day using the windows scheduler. I am having trouble getting it to run my m file. I am using the code below in the Windows 7 professional task scheduler.
This is my action - matlab -r cd('\\lbprds0262\invest\Factset\AssetAllocation\PeerGroups\'),'\\lbprds0262\invest\Factset\AssetAllocation\PeerGroups\PeerGroupMedians_Weekly_FSPull_Auto.m',exit
It launches Matlab just fine but it just sits there and nothing runs.
Thanks! Brian

  0 件のコメント

サインイン to comment.

1 件の回答

Daniel Shub
回答者: Daniel Shub
2012 年 5 月 23 日
 採用された回答

You need to enclose the entire command in quotes. You do not need the path on the function/script you want to run and do not want to put it in quotes. This should work
matlab -r "cd('\\lbprds0262\invest\Factset\AssetAllocation\PeerGroups\'); PeerGroupMedians_Weekly_FSPull_Auto.m; exit"
but I would consider this
cd \\lbprds0262\invest\Factset\AssetAllocation\PeerGroups\
matlab -r "PeerGroupMedians_Weekly_FSPull_Auto.m; exit"
where you change to the desired directory before launching MATLAB.

  1 件のコメント

Brian
2012 年 5 月 23 日
Thanks a bunch - Works perfectly.
-Brian

サインイン to comment.



Translated by