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: cat_roi_fun.m
    path of file: ./repos/cat12
    
    the code of the file until where you have to start completion: function varargout = cat_roi_fun(action,varargin)
% varargout = cat_roi_fun(action,varargin)
% ______________________________________________________________________
% Set of functions to handle CAT ROI processing.
% For file-reading/writing of atlas data use "cat_io_csv" and "cat_io_xml". 
%
%
%  Actions:
%   *
    
function save_ROI_old(p,roi)
% save mean values inside ROI (old xml-files)

  % ROI measures to search for
  ROI_measures = char('Vgm','Vwm','Vcsf','mean_thickness');
  n_ROI_measures = size(ROI_measures,1);

  [path, roi_name, ext] = fileparts(p.calcroi_name);

  n_data = length(roi);

  for i=1:n_data        
    xml = convert(xmltree(deblank(roi{i})));

    if ~isfield(xml,'ROI')
      error('XML file contains no ROI information.');
    end