If I generate a random matrix what is the probability of it to be singular? Just a random question which came to my mind while watching a linear algebra lecture online.  The lecturer said that MATLAB always generates non-singular matrices. I wish to know that in the space of random matrices, what percentage are singular? Is there any work related to this?
A square matrix is singular if and only if the determinant is zero. The determinant is a polynomial in the entries of the matrix. So your question can be thought of as asking the probability that a matrix $A$, viewed as a point in $\mathbb{R}^{n^2}$, will land in the zero set of a polynomial. 

The zero set of a polynomial has Lebesgue measure 0. For a proof, see for instance http://www1.uwindsor.ca/math/sites/uwindsor.ca.math/files/05-03.pdf. 

Therefore its common to say that this probability is zero. 

Note this isn't strictly correct because the Lebesgue measure on $\mathbb{R}^{n^2}$ is not a probability measure. If the entries of the matrix are, say, (multivariate) normally distributed, you are working with an actual probability measure, but the probability is still zero because this measure is absolutely continuous with respect to Lebesgue measure.
The claim is false.  MATLAB can be made to produce a matrix containing only zeroes.  For instance, 

zeros(5,5)


produces a $5 \times 5$ matrix of zeroes.  This matrix is singular and MATLAB can determine this.

det(zeros(5,5))
(*  0  *)


Further, it is no challenge to direct MATLAB to create matrices which are just copies of a single nonzero vector, which will also be singular.  See, for instance, ones(), which can produce a matrix of all ones.