There is no quick way. You have an error at some unknown point in your code. You need to re-examine your code and debug it.
NaN would be produced if you had 0/0 or inf*0
I suggest that at the command prompt you type
dbstop if naninf
and run again. It will stop at the point the first NaN or Infinity is produced.