I am not sure what's wrong, but there are a couple things you can try. With the extra spaces, the prefix to 3dUndump looks strange to me. It didn't work for me when I tried your input. Try removing those spaces. I think the source for bash is not necessary because most shells should work. If you want to specify bash, you can use 'bash -c "echo ..." Also if you write the coordinates to a text file, you can try replacing the stdin input with the text file input. Lastly, because you are already working with matlab, you can use AFNI's matlab library to create the dataset instead of 3dUndump.
[
afni.nimh.nih.gov]