I didn't run into any problems using your command in matlab using your exact command (you're right; the spaces don't matter; they are outside the quotes for matlab variables). My .bashrc is empty though, so that's a small difference. You can specify the path to 3dUndump in the command instead. You can also try using 'cat' to check the numbers are getting piped correctly like this:
>> cmd = ['source ~/.bashrc; echo -45 -67 36 | cat -']
cmd =
source ~/.bashrc; echo -45 -67 36 | cat -
>> system(cmd);
-45 -67 36
If you would like to try the Matlab library, MatAFNI_Demo.m provides some examples of using the various functions, particularly the WriteBrik function.