We have previously derived a theoretical measure of neural complexity (CN) in an attempt to characterize functional connectivity in the brain. CN measures the amount and heterogeneity of statistical correlations within a neural system in terms of the mutual information between subsets of its units. CN was initially used to characterize the functional connectivity of a neural system isolated from the environment. In the present paper, we introduce a related statistical measure, matching complexity (CM), which reflects the change in CN that occurs after a neural system receives signals from the environment. CM measures how well the ensemble of intrinsic correlations within a neural system fits the statistical structure of the sensory input. We show that CM is low when the intrinsic connectivity of a simulated cortical area is randomly organized. Conversely, CM is high when the intrinsic connectivity is modified so as to differentially amplify those intrinsic correlations that happen to be enhanced by sensory input. When the input is represented by an individual stimulus, a positive value of CM indicates that the limited mutual information between sensory sheets sampling the stimulus and the rest of the brain triggers a large increase in the mutual information between many functionally specialized subsets within the brain. In this way, a complex brain can deal with context and go "beyond the information given."