chanlabels.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. function res = chanlabels(this, varargin)
  2. % Method for getting/setting the channel labels
  3. % FORMAT res = chanlabels(this, ind, label)
  4. % _______________________________________________________________________
  5. % Copyright (C) 2008-2012 Wellcome Trust Centre for Neuroimaging
  6. % Vladimir Litvak
  7. % $Id: chanlabels.m 5933 2014-03-28 13:22:28Z vladimir $
  8. if this.montage.Mind == 0
  9. if nargin == 3
  10. ind = varargin{1};
  11. label = varargin{2};
  12. if iscell(label) && length(label)>1
  13. if isnumeric(ind) && length(ind)~=length(label)
  14. error('Indices and values do not match');
  15. end
  16. if length(label)>1
  17. for i = 1:length(label)
  18. for j = (i+1):length(label)
  19. if strcmp(label{i}, label{j})
  20. error('All labels must be different');
  21. end
  22. end
  23. end
  24. end
  25. end
  26. end
  27. res = getset(this, 'channels', 'label', varargin{:});
  28. else
  29. % case with an online montage applied
  30. if nargin == 3
  31. ind = varargin{1};
  32. label = varargin{2};
  33. if iscell(label) && length(label)>1
  34. if isnumeric(ind) && length(ind)~=length(label)
  35. error('Indices and values do not match');
  36. end
  37. if length(label)>1
  38. for i = 1:length(label)
  39. for j = (i+1):length(label)
  40. if strcmp(label{i}, label{j})
  41. error('All labels must be different');
  42. end
  43. end
  44. end
  45. end
  46. end
  47. this.montage.M(this.montage.Mind) = getset(this.montage.M(this.montage.Mind), 'channels', 'label', varargin{:});
  48. res = this;
  49. else
  50. res = getset(this.montage.M(this.montage.Mind), 'channels', 'label', varargin{:});
  51. end
  52. end