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: groupchar.m
    path of file: ./repos/tracacode/1911-COAWST/script/mfiles/inwave_tools
    
    the code of the file until where you have to start completion: function [t,eta_tot,env_eta,bwtot]=groupchar(ndur,Dt,E1,df1,h0)

% h0= 21;   % mean water depth at the boundary
% ndur=1;   % duration of each spectra in hours
% Dt=1;     % time interval for the envelope reconstruction (sec)
% E1=       % 1D wave spectra
% df1=      % frequency increment


    
function [t,eta_tot,env_eta,bwtot]=groupchar(ndur,Dt,E1,df1,h0)

% h0= 21;   % mean water depth at the boundary
% ndur=1;   % duration of each spectra in hours
% Dt=1;     % time interval for the envelope reconstruction (sec)
% E1=       % 1D wave spectra
% df1=      % frequency increment

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%% CREATE TIME VECTOR %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

time=[0:Dt:(ndur*3600)-Dt]';  %sec
np=length(time);

freq=E1(:,1);
Nt = length(freq);
T = Nt/freq(end