/toolboxes/fieldtrip/utilities/ft_datatype_mvar.m

http://brainstream.googlecode.com/ · MATLAB · 106 lines · 20 code · 10 blank · 76 comment · 6 complexity · 5ba10d9e64e16620f80981c1f47d92ab MD5 · raw file

  1. function mvar = ft_datatype_mvar(mvar, varargin)
  2. % FT_DATATYPE_MVAR describes the FieldTrip MATLAB structure for mvar data
  3. %
  4. % The mvar datatype represents multivariate model estimates in the time- or
  5. % in the frequency-domain. This is usually obtained from FT_MVARANALYSIS,
  6. % optionally in combination with FT_FREQANALYSIS.
  7. %
  8. % The following is an example of sensor level MVAR model data in the time
  9. % domain
  10. % dimord: 'chan_chan_lag' defines how the numeric data should be interpreted
  11. % label: {3x1 cell} the channel labels
  12. % coeffs: [3x3x5 double] numeric data (MVAR model coefficients 3 channels x 3 channels x 5 time lags)
  13. % noisecov: [3x3 double] more numeric data (covariance matrix of the noise residuals 3 channels x 3 channels)
  14. % dof: 500
  15. % fsampleorig: 200
  16. % cfg: [1x1 struct]
  17. %
  18. % The following is an example of sensor-level MVAR model data in the frequency
  19. % domain
  20. % dimord: 'chan_chan_freq' defines how the numeric data should be interpreted
  21. % label: {3x1 cell} the channel labels
  22. % freq: [1x101 double] the frequencies, expressed in Hz
  23. % transfer: [3x3x101 double]
  24. % itransfer: [3x3x101 double]
  25. % noisecov: [3x3 double]
  26. % crsspctrm: [3x3x101 double]
  27. % dof: 500
  28. % cfg: [1x1 struct]
  29. %
  30. % Required fields:
  31. % - label, dimord, freq
  32. %
  33. % Optional fields:
  34. % - too many to mention
  35. %
  36. % Deprecated fields:
  37. % - <none>
  38. %
  39. % Obsoleted fields:
  40. % - <none>
  41. %
  42. % Revision history:
  43. %
  44. % (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS
  45. % for further information.
  46. %
  47. % (2008) The initial version was defined.
  48. %
  49. % See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ,
  50. % FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE,
  51. % FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME
  52. % Copyright (C) 2011, Robert Oostenveld
  53. %
  54. % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
  55. % for the documentation and details.
  56. %
  57. % FieldTrip is free software: you can redistribute it and/or modify
  58. % it under the terms of the GNU General Public License as published by
  59. % the Free Software Foundation, either version 3 of the License, or
  60. % (at your option) any later version.
  61. %
  62. % FieldTrip is distributed in the hope that it will be useful,
  63. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  64. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  65. % GNU General Public License for more details.
  66. %
  67. % You should have received a copy of the GNU General Public License
  68. % along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
  69. %
  70. % $Id: ft_datatype_mvar.m 4715 2011-11-10 15:50:03Z roboos $
  71. % get the optional input arguments, which should be specified as key-value pairs
  72. version = ft_getopt(varargin, 'version', 'latest');
  73. if strcmp(version, 'latest')
  74. version = '2011';
  75. end
  76. switch version
  77. case '2011'
  78. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  79. if isfield(mvar, 'grad')
  80. % ensure that the gradiometer balancing is specified
  81. if ~isfield(mvar.grad, 'balance') || ~isfield(mvar.grad.balance, 'current')
  82. mvar.grad.balance.current = 'none';
  83. end
  84. % ensure the new style sensor description
  85. mvar.grad = ft_datatype_sens(mvar.grad);
  86. end
  87. if isfield(mvar, 'elec')
  88. mvar.elec = ft_datatype_sens(mvar.elec);
  89. end
  90. case '2008'
  91. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  92. % there are no known conversions for backward or forward compatibility support
  93. otherwise
  94. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  95. error('unsupported version "%s" for mvar datatype', version);
  96. end