function dat = matrixdata(o, dat)
% matrixdata method - gets matrix from ROI object
if nargin > 1
  if ~isa(o, 'maroi_matrix')
    error('Cannot set matrix from non maroi_matrix object');
  end
  o.dat = dat;
  dat = o;
else
  dat = o.dat;
end