Print

Print


Hi Yihui,

Have you tried spm_changepath? This function searches for all instances of a string and replaces it with a new string. You can do this for any .mat file (or variable I think). Therefore, if your batch jobfile is a .mat file, you can load that .mat file, then enter it as an input in spm_changepath.



Vy T.U. Dinh
Research Assistant, Neurological Sciences
Rush University Medical Center
Phone: (312) 563-3853
Fax: (312) 563-4660
Email: [log in to unmask]

________________________________________
From: SPM (Statistical Parametric Mapping) [[log in to unmask]] on behalf of Chris Watson [[log in to unmask]]
Sent: Wednesday, August 03, 2011 9:14 AM
To: [log in to unmask]
Subject: Re: [SPM] a quick way to change the directory in batch?

There was a script posted to the list awhile back that allows you to
move analysis directories after everything has been specified and
estimated. I'm not sure if that helps your case, but it might, so here
it is:

function [SPM] = spm_remap_scans (SPM,new_path)
% Update path to images - you'll need to do this if you
% copy your original analysis to a different position in your filesystem
% FORMAT [SPM] = spm_remap_scans (SPM,new_path)
%
% SPM       SPM data structure
% new_path

SPM.xY.P = '';
v=length(SPM.xY.VY);
for i=1:v,
    str=SPM.xY.VY(i).fname;
    separators=find(str=='/');
    last_set=max(separators);
    file_name=str(last_set+1:end);
    new_name=[new_path,file_name];
    SPM.xY.VY(i).fname=new_name;
    SPM.xY.VY(i).private.dat.fname = new_name;
    SPM.xY.P(i,:) = new_name;
end


Wood, Tobias wrote:
> Hi Yihui,
> If you open the original batch file in SPM, and bring up the choose file dialogue for the files you need to change the directory of, to the left of the 'Done' button there should be an 'Ed' button. Press this, and you will get a simple text editor window with all the current files. Here, it should be very easy to Cut/Copy/Paste as required to change the directories.
> Hope that helps,
> Toby
> ________________________________________
> From: SPM (Statistical Parametric Mapping) [[log in to unmask]] On Behalf Of SUBSCRIBE SPM Yihui [[log in to unmask]]
> Sent: 03 August 2011 14:41
> To: [log in to unmask]
> Subject: Re: [SPM] a quick way to change the directory in batch?
>
> Dear Andreas,
>
> Thank you for the prompt response.
> I tried what your suggested. However, the new batch file can not be read by spm anymore. The error massage showed "a href=matlab: opentoline[cfg_util, 648, 0,">cfg util at 648" in a pop-out window and "Load failed: 'D:\NeuroSpin\number_syntax\fmri\sub03_ma110333\1stlevel\no_mor\1stlevel_2.mat" in matlab. Anyone has any idea about what it is wrong?
>
> Yihui
>
>