Hi Dirk,

spm_changepath will do what you want.

Below is the help of spm_changepath

>> help spm_changepath
  Recursively replace all occurences of a text pattern in a MATLAB variable.
  FORMAT S = spm_changepath(Sf, oldp, newp)
 
  Sf       - MATLAB variable to fix, or char array of MAT filenames,
             or directory name (all found MAT files will be analysed)
  oldp     - old string to replace
  newp     - new string replacing oldp
 
  S        - updated MATLAB variable (only if Sf is one)
 
  If the pattern is found in a string, any occurence of an invalid file
  separator is replaced to match that of the current system.
 
  If MAT filenames are specified, they will be overwritten with the new
  version. A backup of the initial version is made with a ".old" suffix.
 __________________________________________________________________________
  Copyright (C) 2009-2013 Wellcome Trust Centre for Neuroimaging



Hope this helps,

Kiyotaka


2016-11-24 0:59 GMT+09:00 Schomburg, Dirk <[log in to unmask]>:

Hi all,

 

after moving all the files from a ready done SPM-Analysis from one location in the filesystem to another location in the same ore other file system there are problems to show the results with the SPM "Results" function.

 

Obviously the problem occurs because SPM saves full absolute paths in the SPM.MAT file and after moving all these files the paths don't match any more.

 

To solve this problem it should be possible to write a script which recursively went through all branches from the structure in the SPM.MAT-file and change all the beginnings of the absolute paths to the new beginning of the new location.

 

Did anyone know if such a script already exist and how I would be able to get it? Or is there another better solution for such a situation?

Many thanks for any hint.

 

With kind regards

Dirk Schomburg




--
Kiyotaka Nemoto, M.D., Ph.D.
Associate Professor
Department of Neuropsychiatry
Division of Clinical Medicine, Faculty of Medicine
University of Tsukuba
1-1-1Tennodai Tsukuba, Ibaraki 305-8575, Japan
E-mail: [log in to unmask]