Hi, Stephen
Matlabbatch certainly can be triggered from commandline.
Do something like this
%%load jobs
For i=1:numberofjobs
jobid(i)=cfg_util('initjob',jobfile(i));
end
%%run jobs
For i=1:numberofjobs
If jobid(i)
cfg_util('run',jobfile(i));
end
end
%%remove jobs
For i=1:numberofjobs
Cfg_util('deljob',jobid(i));
end
For more information you can check the cfg_util()function located in matlabbatch folder.
Hope that helps,
Tony
-----Original Message-----
From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]] On Behalf Of Fromm, Stephen (NIH/NIMH) [C]
Sent: Thursday, January 13, 2011 6:43 AM
To: [log in to unmask]
Subject: Re: [SPM] Batching the SPM8 batch engine?
Donald,
The problem is that my "batch.m," as you call it, is just an SPM8 _batch engine_ batch script. That is, it just defines a bunch of "matlabbatch" stuff. Running it within matlab doesn't do anything; it has to be "loaded" and "run" by the SPM8 batch engine. That's the part I'm uncertain how to instantiate in matlab code.
In other words, it's not batch code I wrote myself (calling functions spm_*.m); rather, it's "SPM8 batch engine" batch code.
Best,
S
Stephen J. Fromm, PhD
Contractor, NIMH/MAP
(301) 451--9265
________________________________________
From: MCLAREN, Donald [[log in to unmask]]
Sent: Thursday, January 13, 2011 9:16 AM
To: Fromm, Stephen (NIH/NIMH) [C]
Cc: [log in to unmask]
Subject: Re: [SPM] Batching the SPM8 batch engine?
subjects={}
Currpath=pwd;
for ii=1:length(subjects)
cd([currpath filesep subjects{ii}]);
Batch.m
End
You don't need to load the m file. You can run Ur straight from the
command line.
On Thursday, January 13, 2011, Stephen J. Fromm <[log in to unmask]> wrote:
> I want to do the following (pseudocode):
>
> loop over subjects s {
> cd into directory of s
> load *.m batch script
> run batch script
> }
>
> Is there a way to write a small wrapper script like that?
>
> Or is there a way to "concatenate" the batch scripts for each subject within the matlabbatch "language" itself, with "run" commands in between?
>
> TIA,
>
> S
>
--
Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Postdoctoral Research Fellow, GRECC, Bedford VA
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.
IMPORTANT WARNING: This email (and any attachments) is only intended for the use of the person or entity to which it is addressed, and may contain information that is privileged and confidential. You, the recipient, are obligated to maintain it in a safe, secure and confidential manner. Unauthorized redisclosure or failure to maintain confidentiality may subject you to federal and state penalties. If you are not the intended recipient, please immediately notify us by return email, and delete this message from your computer.
|