function xbeta_break_params_to_rois(rois, destdir)
% ------------------------
% Utility function to carve up existing subject-specific
% .mat files into roi-specific mat files.


rois = spm_str_manip(rois, 'rtdu');

files = spm_get('files', destdir, '*.mat');
for i = 1:size(files,1)
    load(deblank(files(i,:)));
end

for i = 1:size(rois,1)
    curr_outname = fullfile(destdir, [deblank(rois(i,:)) '_params_xbeta.mat']);
    save(curr_outname, ['*_' deblank(rois(i,:)) '_*'], '-mat');
end