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: ui_et_edit.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/marsbar-0.44/@mardo
    
    the code of the file until where you have to start completion: function [D, ic] = ui_et_edit(D, ic)
% method to edit invidual event types in design
% FORMAT [D, ic] = ui_et_edit(D, ic)
% 
% D         - design object
% ic        - index identifying event type to edit (or edited)
% 
% In this case, the return of an empty ic means that the routine was
% cancelled, as this makes no sense otherwise.
% 
% The object method idea here is rather a hack, because the passed object is
% used only to pull in the object methods for the callback.
%
% We first collect all the events from the design, and their names.  The
% event passed, that are IN, get attached to the top (IN) panel, and the
% rest go to the bottom (OUT) panel.  Event names and definitions
% (session, event number pairs) are always sorted according to the
% current sort mode, which is set from the GUI.
% 

    
function [D, ic] = ui_et_edit(D, ic)
% method to edit invidual event types in design
% FORMAT [D, ic] = ui_et_edit(D, ic)
% 
% D         - design object
% ic        - index identifying event type to edit (or edited)
% 
% In this case, the return of an empty ic means that the routine was
% cancelled, as this makes no sense otherwise.
% 
% The object method idea here is rather a hack, because the passed object is
% used only to pull in the object methods for the callback.
%
% We first collect all the events from the design, and their names.  The
% event passed, that are IN, get attached to the top (IN) panel, and the
% rest go to the bottom (OUT) panel.  Event names and definitions
% (session, event number pairs) are always sorted according to the
% current sort mode, which is set from the GUI.
% 
% $Id$

et = event_types(D);
len_et = prod(size(et));
if nargin < 2
  if len_et > 1
    error('Need event number to edit');
  end