def run_jobdef(jobdef): with InTemporaryDirectory(): savemat('pyjobs.mat', jobdef) run_matlab_script(""" load pyjobs; spm_jobman('run', jobs); """)
def spm_path(self): with InTemporaryDirectory() as tmpdir: run_matlab_script(""" spm_path = spm('dir'); fid = fopen('spm_path.txt', 'wt'); fprintf(fid, '%s', spm_path); fclose(fid); """) spm_path = file('spm_path.txt', 'rt').read() return spm_path