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: ft_struct2string.m
    path of file: ./repos/spm12/external/fieldtrip/utilities
    
    the code of the file until where you have to start completion: function [x] = ft_struct2string(x, maxdepth)

% FT_STRUCT2STRING converts all char-array elements in a structur
    
function does the actual work
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [a] = convert(a, depth, maxdepth)

if depth>maxdepth
  % only convert up to the specified level
  return
end