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: getdatfield.m
    path of file: ./repos/spm/external/fieldtrip/utilities/private
    
    the code of the file until where you have to start completion: function [datfield, dimord] = getdatfield(data)


    
function [datfield, dimord] = getdatfield(data)

% GETDATFIELD
%
% Use as
%   [datfield, dimord] = getdatfield(data)
% where the output arguments are cell-arrays.
%
% See also GETDIMORD, GETDIMSIZ

datfield  = fieldnames(data);
datfield  = datfield(:)'; % it should be a row-vector throughout the subsequent code

% these descriptive fields are cell-arrays and not treated as data
% the descriptive fields such as time and freq can be treated as data
datfield  = setdiff(datfield, {'label' 'labelcmb'});
datfield  = setdiff(datfield, ignorefields('selectdata'));

% find substructure fields
structfield = {};
for i=1:numel(datfield)
  if isstruct(data.(datfield{i}))
    structfield(end