Here's a bash snippet that might enlighten (comments included for tcsh-ers):
labels=(even odd) # define array
N=${#labels[@]} # length of array
# $(...) is command substitution; $((...)) is arithmetic
for i in $(seq 0 $((N-1))); do
# ${array[n]} is array access
3dTcat -prefix fred.${labels[i]} "fred+orig[$i..\$(N)]"
done
3dTcat -prefix fred.recon \
$(for i in $(seq 0 $(3dinfo -nvi fred+orig)); do
# automatic arithmetic expansion inside array access
echo "fred.${labels[i%N]}+orig[$((i/N))]"
done)
Note that this still works even if there are an odd number of volumes.
Make sure AFNI_COMPRESSOR is unset when you do this; otherwise it could take hours as AFNI unzips the same dataset over and over.
Edited 4 time(s). Last edit at 06/17/2015 04:48PM by Isaac Schwabacher.