Step-1: Get all the blocks and subsystems in the model using find_system(modelname,'Type','Block')
Step-2: Apply Simulink.BlockDiagram.expandSubsystem(blockname). This type of Subsystem expansion applies to the currently selected subsystem level. Simulink does not expand other subsystems in a nested subsystem hierarchy which is the functionality you are looking for.
blocks = find_system(model_name,'Type','Block');
for i = 1:numel(blocks)
Hope it helps.