Below is a problem consisting of a spherical shell at the center of a cube. Three subdomains are identified: the shell, the spherical space inside the shell, and the outer enclosing space of the cube/box. I have what I believe is an issue where the identity of the outer subdomain is numbered #3 in the Equation mode yet is treated as subdomain #2 in the Grid mode when specifying grid size in the Grid Generation Settings window.
The following shows the grid settings. Note the large grid size, ".4", is for the second subdomain (#2):
Generating the grid, exporting the fea struct to MATLAB and viewing the grid it by slicing off all with negative 'x' using:
%% Clear FEAtool plot area (except for axes)
It is not guarateed that the given subdomain numbering will be respected by extenal tools such as Gmsh. In these cases you will simply have to use trial and error to deduce the subdomain or boundary numbers.