The matrix or groundmass of rock is the finer-grained mass of material wherein larger grains, crystals or clasts are embedded.
The matrix of an igneous rock consists of finer-grained, often microscopic, crystals in which larger crystals (phenocrysts) are embedded. This porphyritic texture is indicative of multi-stage cooling of magma. For example, porphyritic andesite will have large phenocrysts of plagioclase in a fine-grained matrix. Also in South Africa, diamonds are often mined from a matrix of weathered clay-like rock (kimberlite) called "yellow ground".
The matrix of sedimentary rocks is finer-grained sedimentary material, such as clay or silt, in which larger grains or clasts are embedded. It also used to describe the rock material in which a fossil is embedded.
All sediments are at first in an incoherent condition (e.g. sands, clays and gravels, beds of shells, etc.), and in this state they may remain for an indefinite period. Millions of years have elapsed since some of the early Tertiary strata gathered on the ocean floor, yet they are quite friable (e.g. the London Clay) and differ little from many recent accumulations. There are few exceptions, however, to the rule that with increasing age sedimentary rocks become more and more indurated, and the older they are the more likely it is that they will have the firm consistency generally implied in the term "rock".
The pressure of newer sediments on underlying masses is apparently one cause of this change, though not in itself a very powerful one. More efficiency is generally ascribed to the action of percolating water, which takes up certain soluble materials and redeposits them in pores and cavities. This operation is probably accelerated by the increased pressure produced by superincumbent masses, and to some extent also by the rise of temperature which inevitably takes place in rocks buried to some depth beneath the surface. The rise of temperature, however, is never very great; we know more than one instance of sedimentary deposits which have been buried beneath four or five miles of similar strata (e.g. parts of the Old Red Sandstone), yet no perceptible difference in condition can be made out between beds of similar composition at the top of the series and near its base.