subsasgn.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. function this = subsasgn(this,subs,dat)
  2. % Overloaded subsasgn function for meeg objects.
  3. % _________________________________________________________________________________
  4. % Copyright (C) 2008-2011 Wellcome Trust Centre for Neuroimaging
  5. % Vladimir Litvak
  6. % $Id: subsasgn.m 5025 2012-10-31 14:44:13Z vladimir $
  7. if isempty(subs)
  8. return;
  9. end;
  10. if strcmp(subs(1).type, '.')
  11. if ismethod(this, subs(1).subs)
  12. error('meeg method names cannot be used for custom fields');
  13. else
  14. if isempty(this.other)
  15. this.other = struct(subs(1).subs, []);
  16. this.other = builtin('subsasgn', this.other, subs, dat);
  17. else
  18. this.other = builtin('subsasgn', this.other, subs, dat);
  19. end
  20. end
  21. elseif strcmp(subs(1).type, '()')
  22. if ~islinked(this), error('The object is not linked to data file'); end
  23. if numel(subs)~= 1, error('Expression too complicated'); end
  24. if this.montage.Mind>0
  25. error('Attempt to assign to a meeg object with online montage applied.');
  26. end;
  27. this.data = subsasgn(this.data, subs, dat);
  28. else
  29. error('Unsupported assignment type for meeg.');
  30. end