  We study the random walk of a particle in a compartmentalized environment, as
realized in biological samples or solid state compounds. Each compartment is
characterized by its length $L$ and the boundaries transmittance $T$. We
identify two relevant spatio-temporal scales that provide alternative
descriptions of the dynamics: i) the microscale, in which the particle position
is monitored at constant time intervals; and ii) the mesoscale, in which it is
monitored only when the particle crosses a boundary between compartments. Both
descriptions provide --by construction-- the same long time behavior. The
analytical description obtained at the proposed mesoscale allows for a complete
characterization of the complex movement at the microscale, thus representing a
fruitful approach for this kind of systems. We show that the presence of
disorder in the transmittances is a necessary condition to induce anomalous
diffusion, whereas the spatial heterogeneity reduces the degree of subdiffusion
and, in some cases, can even compensate for the disorder induced by the
stochastic transmittance.
