I need to use some toolbox in Matlab and haven't used Matlab in a long time. Wondering how to use a string variable for a placeholder when identifying a file in the pathway. For example in bash, ${SUBJID}/file1/abcd.nii, will the fullpath() in matlab works the same way, and how to save the output to the corresponding pathway?
a: A001/A001/file1/abcd.nii
b: A001/A001/file2/diff/mask.nii
output: A001/A001/file/output.txt
bash:
export SUBJECTS_DIR=dir\
cd $SUBJECTS_DIR
SUBJID_LIST=[A001, A002, A003, B001, B002, ......]
for SUBJID in "${SUBJID_LIST[@]}"; do function
-a ${SUBJID}/${SUBJID}/file1/abcd.nii
-b ${SUBJID}/${SUBJID}/file2/diff/mask.nii
-output ${SUBJID}/${SUBJID}/file/output; done
matlab:
SUBJID_LIST=[A001, A002, A003, B001, B002, ......]
for i in SUBJID_list
path=dir\
a=fullpath(path,i,abcd.nii) ??
b=fullpath(path,i,mask.nii) ??
output=function(a,b)
writetable(output, "??? output.txt")
end