You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: function_check_generatedmicrostructure.m
    path of file: ./repos/MATBOX_Microstructure_analysis_toolbox/src/Microstructure_generation
    
    the code of the file until where you have to start completion: function [] = function_check_generatedmicrostructure(microstructure3D,phase,OPTIONS)

OPTIONS.fontname = 'Times New Roman';
OPTIONS.grid = 'on';
OPTIONS.minorgrid = 'on';
OPTIONS.save_fig = true; % always true
OPTIONS.savefig_infig = true; % always true 
OPTIONS.savefig_informat = {'png'}; % always 'png'
OPTIONS.closefigureaftercreation = false;



%% VOLUME FRACTIONS


domain_size = size(microstructure3D.phase);
number_phase = length(phase);
voxel_number = prod(domain_size);
area_xy= domain_size(1)*domain_size(2);
% Total
for current_phase = 1:1:number_phase
   phase(current_phase).volumefraction.aftergeneration = sum(sum(sum( microstructure3D.phase == phase(current_phase).code))) / voxel_number;
   phase(current_phase).volumefraction. remain = phase(cur
    
function
%     end
%     if OPTIONS.closefigureaftercreation == true
%         close(Fig); % Do not keep open figures
%     end
end

% Figure (particle size repartition)
for current_phase=1:1:number_phase % Loop over phases
    Fig = figure; % Create figure
    Fig.Name= ['Particle size repartition ' phase(current_phase).name]; % Figure name
    Fig.Color='white'; % Background colour
    scrsz = get(0,'ScreenSize'); % Screen resolution
    set(Fig,'position',scrsz); % Full screen figure
    % - Create axes as a subplot
    %x_ = [1:1:domain_size(3)] * voxel_size_um;
    x_ = [1:1:domain_size(3)] * 1;
    % Plot graphs
    for id_axe=1:1:3
        sub_axes=subplot(1,3,id_axe,'Parent',Fig);
        hold(sub_axes,'on'); % Active subplot
        if id_axe==1
            str_title = 'Diameter dx in-plane repartition';
            ylabel('Volume repartition (%)');
            %lgd_title = 'Diameter in \mum;';
            lgd_title = 'Diameter in voxel length;';
            %values_ = phase(current_phase).unique_dx_diameter * voxel_size_um;
            values_ = phase(current_phase).unique_dx_diameter * 1;
            y_obtained = phase(current_phase).diameter_dx.along_3rd_axis_allslice_calculatedaftergeneration;
            % Legend