# Replace error messages with zeros in a table

I'm working on a project of Nuclear physics and I'm passing results of a simulation program to mathematica via a txt file. I then read the values I need to read and plot them. The problem is that sometimes those values don't appear on the file, and then mathematica gets an "end of file" error instead of a value when I try to find them. Everything works fine with the plot, but if I want to show the results on a table it's all messed up and filled with errors.

TL;DR

How do I remove all the errors from a list like this:

{{40.,InternalStringToDouble[StringSplit[EndOfFile][[6]]]},
{45.45,InternalStringToDouble[StringSplit[EndOfFile][[6]]]},{50.91,49.5},
{56.36,78.9},{61.82,70.9},{67.27,32.6},{72.73,9.4},{78.18,3.9},{83.64,1.1},
{89.09,0.2},{94.55,0.1},{100.,InternalStringToDouble[StringSplit[EndOfFile][[6]]]}}


replacing them with zeros?

I want to get something like this:

    {{40.,0},{45.45,0},{50.91,49.5},{56.36,78.9},{61.82,70.9},{67.27,32.6},
{72.73,9.4},{78.18,3.9},{83.64,1.1},{89.09,0.2},{94.55,0.1},{100.,0}}


Thanks and sorry for the messy question.

• (at) DoubleCat: It seems as if the value 0 is misinterpreted as an EOF marker. Try writing 0.0 instead of 0 in your text file. – Dr. Wolfgang Hintze Sep 21 '14 at 17:30
• That is what I want to get, I don't know how to do it – DoubleCat Sep 21 '14 at 17:33
• To try it, take a small txt file, replace an exact 0 by 0.0 e.g. by hand, and then pass this file to Mathematica. Do the error messages remain? If not, then you should adapt your text generation to include just this replacement. If yes, I don't know ... – Dr. Wolfgang Hintze Sep 21 '14 at 17:37
• Replace[YourList, x_ /; Not@NumericQ@x :> 0, {2}] – Dr. belisarius Sep 21 '14 at 17:41

data /. InternalStringToDouble[__] -> 0