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: ArchiveUpdate.m
    path of file: ./repos/PlatEMO/PlatEMO/Algorithms/Multi-objective optimization/DEA-GNG
    
    the code of the file until where you have to start completion: function [Data,nND] = ArchiveUpdate(Data,N,Z1,Z2,Zmin)
% Update Input Signal Archive in DEA-GNG

%--------------------------------------------------------------------------
% Copyright Yiping Liu
% Please contact {yiping0liu@gmail.com} if you have any problem.
%--------------------------------------------------------------------------

    %% Delete duplicate
    Data = unique(Data,'rows');


    
function [Data,nND] = ArchiveUpdate(Data,N,Z1,Z2,Zmin)
% Update Input Signal Archive in DEA-GNG

%--------------------------------------------------------------------------
% Copyright Yiping Liu
% Please contact {yiping0liu@gmail.com} if you have any problem.
%--------------------------------------------------------------------------

    %% Delete duplicate
    Data = unique(Data,'rows');

    %% Non-dominated sorting
    FrontNo = NDSort(Data,N);
    Data = Data((FrontNo == 1)',:);
    nND = size(Data,1);
    
    %% Selection
    if nND > N        
       Choose = LastSelection(Data,N,Z1,Z2,Zmin);
        Data = Data(Choose',:); 
        nND = N;      
    end