Run SPM2, SPM5, and SPM8 concurrently

Many SPMers use different versions of SPM. We can run different versions of SPM in one computer, but we need to set MATLAB path carefully.

I had some discussion with Volkmar Glauche and Guillaume Flandin, who kindly gave me advice how to write the script for running diferrent spms.

Below is the scripts which enables us to run SPM2, SPM5, and SPM8 concurrently.

  1. make a directory where you want to save scripts. (e.g. ~/spm_paths/)
  2. add the directory to the path in Matlab. (File -> Set Path -> Add path)
  3. put spm_rmpath.m in SPM2 folder.
  4. You find this file in SPM5 or SPM8 directory. You can just copy it from SPM5/8 to SPM2 directory.

  5. write scripts to run spm2, spm5, and spm8
  6. suppose your spm2, spm5, and spm8 directories are “/usr/local/spm2″, “/usr/local/spm5″, and “/usr/local/spm8″. (change the pathname to your circumstance)

    %%%%%%%%%%%%%%% spm2.m
    % remove spm path
    while true
    try, spm_rmpath; catch break; end
    end
    % add spm2 path
    addpath /usr/local/spm2;
    % run spm2
    spm;

    %%%%%%%%%%%%%%% spm5.m
    % remove spm path
    while true
    try, spm_rmpath; catch break; end
    end
    % add spm5 path
    addpath /usr/local/spm5;
    % run spm5
    spm;

    %%%%%%%%%%%%%%% spm8.m
    % remove spm path
    while true
    try, spm_rmpath; catch break; end
    end
    % add spm8 path
    addpath /usr/local/spm8;
    % run spm8
    spm;

    (Of course you can add any paths you like between “addpath /usr/local/spm/spm2/5/8″
    and “spm”)

  7. save these scripts in the directory ~/spm_paths/
  8. In a matlab window, type “spm2″
  9. In another matlab window, type “spm5″
  10. In another matlab window, type “spm8″

Now you can run different versions of SPM concurrently.

Run SPM2, SPM5, and SPM8 concurrently” へのコメント

  1. ピングバック: SPM switcher: Run different versions of SPM in one Matlab

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください