A technique has been developed that allows determination of the concentration profiles of colloidal solutions or any kind of fluid under confinement. Currently, submicrometre-wide channels are sampled with a resolution in the 10 nm range. The method comprises regular arrays of microfluidic channels and one-dimensional X-ray phase-retrieval techniques for the analysis of small-angle X-ray diffraction from the array structures. Recording the X-ray diffraction data requires a low dose on each individual channel since the sum of the signals from all channels is detected. The determined concentration profiles represent the ensemble average rather than individual entities and are obtained in a model-independent way. As an example, amplitude and phase of the exit field and concentration profiles for a colloidal fluid within confining channels of different widths are shown.