PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/external/fieldtrip/trunk/utilities/ft_datatype_freq.m

http://open-realtime-fmri.googlecode.com/
MATLAB | 97 lines | 13 code | 10 blank | 74 comment | 5 complexity | 85b538c2f8c7fc80b1ea8d21b5efa00f MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. function freq = ft_datatype_freq(freq, varargin)
  2. % FT_DATATYPE_FREQ describes the FieldTrip MATLAB structure for freq data
  3. %
  4. % The freq data structure represents frequency or time-frequency decomposed
  5. % channel-level data. This data structure is usually generated with the
  6. % FT_FREQANALYSIS function.
  7. %
  8. % An example of a freq structure containing the powerspectrum for 306 channels
  9. % and 102 frequencies is
  10. %
  11. % dimord: 'chan_freq' defines how the numeric data should be interpreted
  12. % powspctrm: [306x120 double] the power spectum
  13. % label: {306x1 cell} the channel labels
  14. % freq: [1x120 double] the frequencies expressed in Hz
  15. % cfg: [1x1 struct] the configuration used by the function that generated this data structure
  16. %
  17. % An example of a freq structure containing the time-frequency resolved
  18. % spectral estimates of power (i.e. TFR) for 306 channels, 120 frequencies
  19. % and 60 timepoints is
  20. %
  21. % dimord: 'chan_freq_time' defines how the numeric data should be interpreted
  22. % powspctrm: [306x120x60 double] the power spectum
  23. % label: {306x1 cell} the channel labels
  24. % freq: [1x120 double] the frequencies, expressed in Hz
  25. % time: [1x60 double] the time, expressed in seconds
  26. % cfg: [1x1 struct] the configuration used by the function that generated this data structure
  27. %
  28. % Required fields:
  29. % - label, dimord, freq
  30. %
  31. % Optional fields:
  32. % - powspctrm, fouriesspctrm, csdspctrm, cohspctrm, time, labelcmb, grad, elec
  33. %
  34. % Deprecated fields:
  35. % - <none>
  36. %
  37. % Obsoleted fields:
  38. % - <none>
  39. %
  40. % Revision history:
  41. %
  42. % (2008/latest) The presence of labelcmb in case of crsspctrm became optional,
  43. % from now on the crsspctrm can also be represented as Nchan * Nchan.
  44. %
  45. % (2006) The fourierspctrm field was added as alternative to powspctrm and
  46. % crsspctrm.
  47. %
  48. % (2003) The initial version was defined.
  49. %
  50. % See also FT_DATATYPE and FT_DATATYPE_xxx
  51. % Copyright (C) 2011, Robert Oostenveld
  52. %
  53. % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
  54. % for the documentation and details.
  55. %
  56. % FieldTrip is free software: you can redistribute it and/or modify
  57. % it under the terms of the GNU General Public License as published by
  58. % the Free Software Foundation, either version 3 of the License, or
  59. % (at your option) any later version.
  60. %
  61. % FieldTrip is distributed in the hope that it will be useful,
  62. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  63. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  64. % GNU General Public License for more details.
  65. %
  66. % You should have received a copy of the GNU General Public License
  67. % along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
  68. %
  69. % $Id: ft_datatype_freq.m 3029 2011-03-01 20:54:20Z roboos $
  70. % get the optional input arguments, which should be specified as key-value pairs
  71. version = keyval('version', varargin); if isempty(version), version = 'latest'; end
  72. if strcmp(version, 'latest')
  73. version = '2008';
  74. end
  75. % ensure consistency between the dimord string and the axes that describe the data dimensions
  76. freq = fixdimord(freq);
  77. switch version
  78. case '2008'
  79. % there are no known conversions for backward or forward compatibility support
  80. case '2006'
  81. % there are no known conversions for backward or forward compatibility support
  82. case '2003'
  83. % there are no known conversions for backward or forward compatibility support
  84. otherwise
  85. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  86. error('unsupported version "%s" for freq datatype', version);
  87. end