struct.m 603 B

123456789101112131415161718
  1. function s = struct(this)
  2. % Struct method for GIfTI objects
  3. % FORMAT s = struct(this)
  4. % this - GIfTI object
  5. % s - a structure containing public fields of the object
  6. %__________________________________________________________________________
  7. % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
  8. % Guillaume Flandin
  9. % $Id: struct.m 6507 2015-07-24 16:48:02Z guillaume $
  10. names = fieldnames(this);
  11. values = cell(length(names), length(this(:)));
  12. for i=1:length(names)
  13. [values{i,:}] = subsref(this(:), substruct('.',names{i}));
  14. end
  15. s = reshape(cell2struct(values,names,1),size(this));