In this paper, we have introduced a scalable and generalizable 2D matrix representation for the crystal structure of the inorganic materials. The representation contains the crystallographic information of the structure as well as the properties of the constituent elements and has no limitation in terms of the type of the crystal structure or the stoichiometry. 2D matrix representation was used to train a conditional variational autoencoder model, which was then used for the targeted generation of the stable or unstable crystal structures based on the value of the formation energy.