help > Error with preprocessing batch
Apr 15, 2024  01:04 PM | lidizpe
Error with preprocessing batch

Hi everyone!


I am trying to modify a script to run the preprocessing, but there is a problem finding the files. 


This was the original script from Andrew Jahn. 


NSUBJECTS=3;
cwd=pwd;
FUNCTIONAL_FILE=cellstr(conn_dir('sub-*_func_sub-*_task-rest_bold.nii.gz'));
STRUCTURAL_FILE=cellstr(conn_dir('sub-*_anat_sub-*_T1w.nii'));
if rem(length(FUNCTIONAL_FILE),NSUBJECTS),error('mismatch number of functional files %n', length(FUNCTIONAL_FILE));end
if rem(length(STRUCTURAL_FILE),NSUBJECTS),error('mismatch number of anatomical files %n', length(FUNCTIONAL_FILE));end
nsessions=length(FUNCTIONAL_FILE)/NSUBJECTS;
FUNCTIONAL_FILE=reshape(FUNCTIONAL_FILE,[nsessions, NSUBJECTS]);
STRUCTURAL_FILE={STRUCTURAL_FILE{1:NSUBJECTS}};
disp([num2str(size(FUNCTIONAL_FILE,1)),' sessions']);
disp([num2str(size(FUNCTIONAL_FILE,2)),' subjects']);
TR=3.56; % Repetition time


 


If I run it with like this  it doesn't take any file


"
FUNCTIONAL_FILE=cellstr(conn_dir('sub-*', 'func', 'xsub-*'));
STRUCTURAL_FILE=cellstr(conn_dir('sub-*', 'anat', '*T1w.nii.gz'))
"


if I change it, and run it with fullfile.. 


"
FUNCTIONAL_FILE = cellstr(conn_dir(fullfile('sub-*', 'func', 'xsub-*')));
STRUCTURAL_FILE=cellstr(conn_dir(fullfile('sub-*', 'anat', '*T1w.nii.gz')));
"


it supose to found a file, cause inside functional_file array there is 'sub-*\func\xsub-001C_task-rest_run-01_bold.nii', but it doesn't run the preprocessing. 


I've tried everything so any help will be more than welcome and thank  you!