There might be a way to redirect output from stdout in a mex file ( see this question ), but I haven't been able to get it to work on Windows yet.
What I was able to use was the old cuPrintf code which came before the CUDA printf, and is still available in the CUDA SDK sample "simplePrintf", and redirect the output to a file.