PageRenderTime 28ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/utility/initpc6header.m

http://acq3.googlecode.com/
MATLAB | 227 lines | 186 code | 20 blank | 21 comment | 0 complexity | 81dd315a3689e204f27eab1c583fa18d MD5 | raw file
  1. function [pc6h] = initpc6header();
  2. %INITPC6HEADER INitializes header information for a pClamp 6.x Axon Binary File (ABF).
  3. % PC6H = INITPC6HEADER() returns a structure with all header information initialized.
  4. % (modified from getpc6header by Carsten Hohnke 12/99)
  5. % Mods and updated for version 1.5, P. Manis, 2/2002
  6. %
  7. pc6h.size=2048;
  8. % file ID and size information
  9. pc6h.sFileType='ABF '; % fread(fid,4,'char'); % pointing to byte 0 ('ABF')
  10. pc6h.fFileVersionNumber=1.5; % fread(fid,1,'float'); % 4 (1.5 for current file)
  11. pc6h.nOperationMode= 3; % fread(fid,1,'short'); % 8 (3 = gapfree).
  12. pc6h.lActualAcqLength= 0; % fread(fid,1,'int'); % 10 (total ADC samples in file)
  13. pc6h.nNumPointsIgnored= 0; % fread(fid,1,'short'); % 14 (0)
  14. pc6h.lActualEpisodes=1; % fread(fid,1,'int'); % 16 (1 for gapfree, otherwise # sweeps)
  15. pc6h.lFileStartDate=010101; % fread(fid,1,'int'); % 20 (yymmdd)
  16. pc6h.lFileStartTime=0; % fread(fid,1,'int'); % 24 (seconds past midnight)
  17. pc6h.lStopwatchTime= 0; % fread(fid,1,'int'); % 28 (0)
  18. pc6h.fHeaderVersionNumber=1.5; % fread(fid,1,'float'); % 32 (1.5)
  19. pc6h.nFileType=1; % fread(fid,1,'short'); % 36 (1 = ABF)
  20. pc6h.nMSBinFormat=0; % fread(fid,1,'short'); % 38 (0 for IEEE format...)
  21. % file structure
  22. pc6h.lDataSectionPtr=0; % fread(fid,1,'int'); % 40 (block number of DATA section)
  23. pc6h.lTagSectionPtr=0; % fread(fid,1,'int'); % 44 (block number of Tag section)
  24. pc6h.lNumTagEntries=0; % fread(fid,1,'int'); % 48 (Number of Tag entries)
  25. pc6h.lLongDescriptionPtr=4; % fread(fid,1,'int'); % 52 (Block number of Scope Config Pointer)
  26. pc6h.lLongDescriptionLines=1; % fread(fid,1,'int'); % 56 (Number of Scope Config sections)
  27. pc6h.lDACFilePtr=0; % fread(fid,1,'int'); % 60 (block number of start of DAC section)
  28. pc6h.lDACFileNumEpisodes=0; % fread(fid,1,'int'); % 64 (number of sweeps in DAC sectoin)
  29. pc6h.sUnused68=zeros(1,4); % fread(fid,4,'char'); % 4char % 68 (unused)
  30. pc6h.lDeltaArrayPtr=0; % fread(fid,1,'int'); % 72 (block number of Delta array section)
  31. pc6h.lNumDeltas=0; % fread(fid,1,'int'); % 76 (number of entries in Delta array section)
  32. pc6h.lNotebookPtr=0; % fread(fid,1,'int'); % 80 (block number of voice tag section)
  33. pc6h.lNotebookManEntries=0; % fread(fid,1,'int'); % 84 (number of voice tag entries)
  34. pc6h.lNotebookAutoEntries=0; % fread(fid,1,'int'); % 88 (unused)
  35. pc6h.lSynchArrayPtr = 0; % fread(fid,1,'int'); % 92 (block number of synch array section_
  36. pc6h.lSynchArraySize = 0; % fread(fid,1,'int'); % 96 (number of PAIRS of entries in synch array section)
  37. pc6h.nDataFormat = 0; % fread(fid,1,'short'); % 100 (data representation: 0 = 2-byte integer, 1 = IEEE 4 byte float)
  38. pc6h.nSimultaneousScan=0; % fread(fid, 1, 'short'); % 102 (ADC channel scanning mode 0=mux, 1=simul; NOT IMPLEMENTED)
  39. pc6h.sUnused102=zeros(1,16); % fread(fid,16,'char'); % 18char % 102 (
  40. % Trial hierarhcy information
  41. pc6h.nADCNumChannels=1; % fread(fid,1,'short'); % 120 (number of analog input channels sampled)
  42. pc6h.fADCSampleInterval=50; % fread(fid,1,'float'); % 122 (interval between multiplexed channels)
  43. pc6h.fADCSecondSampleInterval=0; % fread(fid,1,'float'); % % 126 (when switching clocks)
  44. pc6h.fSynchTimeUnit=0; % fread(fid,1,'float'); % 130 (synch array time unit: 0 = samples, nn = usec. normally 0)
  45. pc6h.fSecondsPerRun=0; % fread(fid,1,'float'); % 134 (gapfree: duration of acq; otherwise set to -1 (ignore and refer to lEpisodesPerRun))
  46. pc6h.lNumSamplesPerEpisode= 300; % fread(fid,1,'int'); % 138 (# muxed ADC samples per sweep if mode is 2, 4 or 5; undefined if mode is 1 or 3)
  47. pc6h.lPreTriggerSamples=0; % fread(fid,1,'int'); % 142 (pretrigger intervals = 0)
  48. pc6h.lEpisodesPerRun=1; % fread(fid,1,'int'); % 146 (sweeps per run. if gapfree, set to 1.
  49. pc6h.lRunsPerTrial=1; % fread(fid,1,'int'); % 150 (runs per trial. if gapfree, set to 1.
  50. pc6h.lNumberOfTrials=1; % fread(fid,1,'int'); % 154 (set to 1)
  51. pc6h.nAveragingMode=0; % fread(fid,1,'short'); % 158 (0 = no averaging)
  52. pc6h.nUndoRunCount=0; % fread(fid,1,'short'); % 160 set to 0
  53. pc6h.nFirstEpisodeInRun=0; % fread(fid,1,'short'); % 162 (set to 0)
  54. pc6h.fTriggerThreshold=0; % fread(fid,1,'float'); % 164 (user units: set to 0)
  55. pc6h.nTriggerSource=-3; % fread(fid,1,'short'); % 168 (set to -1 for external, > 0 for physical channel number, -3 for start-to-start interval)
  56. pc6h.nTriggerAction=0; % fread(fid,1,'short'); % 170 (0 = one sweep, 1 = one run, 2 = one trial)
  57. pc6h.nTriggerPolarity=0; % fread(fid,1,'short'); % 172 (0 = rising, 1 == falling)
  58. pc6h.fScopeOutputInterval=0; % fread(fid,1,'float'); % 174 (set to 0)
  59. pc6h.fEpisodeStartToStart=0; % fread(fid,1,'float'); % 178 (time between start of sweeps, in seconds = cycle time)
  60. pc6h.fRunStartToStart=0; % fread(fid,1,'float'); % 182 (time between start of runs (seconds)
  61. pc6h.fTrialStartToStart=0; % fread(fid,1,'float'); % 186 (time between trials (seconds)
  62. pc6h.lAverageCount=0; % fread(fid,1,'int'); % 190 (number of runs for each average: set to 1)
  63. pc6h.lClockChange=0; % fread(fid,1,'int'); % 194 (# samples after which second sampling interval begins: set to -1)
  64. pc6h.nAutoTriggerStrategy=1; % fread(fid,1,'short'); % 2char % 198 (0 = do not auto trig; 1 = autotrig; only when nOpmode = highspeed osc).
  65. % display parameters
  66. pc6h.nDrawingStrategy=1; % fread(fid,1,'short'); % 200 (0 = not draw, 1 = update immed.... set to 0)
  67. pc6h.nTiledDisplay=1; % fread(fid,1,'short'); % 202 (set to 0)
  68. pc6h.nEraseStrategy=1; % fread(fid,1,'short'); % 204 (set to 2)
  69. pc6h.nDataDisplayMode=1; % fread(fid,1,'short'); % 206 (set to 1 = lines)
  70. pc6h.lDisplayAverageUpdate=0; % fread(fid,1,'int'); % 208 (set to -1)
  71. pc6h.nChannelStatsStrategy=0; % fread(fid,1,'short'); % 212 (set to 0)
  72. pc6h.lCalculationPeriod=10000; % fread(fid,1,'int'); % 214 (set to 16384)
  73. pc6h.lSamplesPerTrace=655360; % fread(fid,1,'int'); % 218 (number of multiplexed adc samples displayed per trace)
  74. pc6h.lStartDisplayNum=0; % fread(fid,1,'int'); % 222 (set to 1)
  75. pc6h.lFinishDisplayNum=300; % fread(fid,1,'int'); % 226 (set to 0 to finish at end of sweep)
  76. pc6h.nMultiColor=1; % fread(fid,1,'short'); % 230 (set to 1 for multicolor)
  77. pc6h.nShowPNRawData=0; % fread(fid,1,'short'); % 232 (set to 0 for display corrected data
  78. pc6h.fStatisticsPeriod=1; % fread(fid, 1, 'float'); % 234 set to 0
  79. pc6h.lStatisticsMeasurements=5; % fread(fid, 1, 'long'); % 238 set to 0
  80. pc6h.nstatisticsSaveStrategy=0; % fread(fid, 1, 'short'); % 242 set to 0 for auto
  81. % hardware information
  82. pc6h.fADCRange=10.; % fread(fid,1,'float'); % 244 ADC-full scale (5 or 10 V)
  83. pc6h.fDACRange=10.; % fread(fid,1,'float'); % 248 DAC full scale (10V)
  84. pc6h.lADCResolution=4096; % fread(fid,1,'int'); % 252 number of adc counts corresponding to full scale voltage: 2048 or 16384
  85. pc6h.lDACResolution=4096; % fread(fid,1,'int'); % 256 dac counts for full scale....
  86. % Environment information
  87. pc6h.nExperimentType=2; % fread(fid,1,'short'); % 260 % 0 for voltage clamp, 1 for current clamp
  88. pc6h.nAutosampleEnable=1; % fread(fid,1,'short'); % 262 % set to 0 (disabled)
  89. pc6h.nAutosampleADCNum=0; % fread(fid,1,'short'); % 264 % physical sample number for autosample: set to 1
  90. pc6h.nAutosampleInstrument=0; % fread(fid,1,'short'); % 266 % instrument: set to 0 (unknown)
  91. pc6h.fAutosampleAdditGain=1; % fread(fid,1,'float'); % 268 % additional gain multiplier (set to gain reading or 1)
  92. pc6h.fAutosampleFilter=0; % fread(fid,1,'float'); % 272 % low pass filter (set to LPF reading or 100000)
  93. pc6h.fAutosampleMembraneCapacitance=0; % fread(fid,1,'float'); % 276 cap : set to 0 (not read)
  94. pc6h.nManualInfoStrategy=0; % fread(fid,1,'short'); % 280 set to 0.
  95. pc6h.fCellID1=0; % fread(fid,1,'float'); % 282 numeric cell identifier (set to 1)
  96. pc6h.fCellID2=0; % fread(fid,1,'float'); % 286 numeric identifier (set to 0)
  97. pc6h.fCellID3=0; % fread(fid,1,'float'); % 290 numeric identifier (set to 0)
  98. pc6h.sCreatorInfo=sprintf('%-16s', 'Clampex 6.0'); % fread(fid,16,'char'); % 16char % 294 write as "Clampex 6.0"
  99. pc6h.sFileComment=32*ones(1, 56); % fread(fid,56,'char'); % 56char % 310 56 byte ascii comment string (copy comment here)
  100. pc6h.sUnused366=zeros(1,12); % fread(fid,12,'char'); % 12char % 366 unused
  101. % Multichannel information
  102. pc6h.nADCPtoLChannelMap=[0:15]; % fread(fid,16,'short'); % 378 physical to logical channel map (end with -1 if fewer than 16)
  103. pc6h.nADCSamplingSeq=[1,-1*ones(1,15)]; % fread(fid,16,'short'); % 410 ADC sampling sequence (pad with -1 if fewer than 16)
  104. pc6h.sADCChannelName=32*ones(1, 16*10); % fread(fid,16*10,'char'); % 442 channel names (set to spaces)
  105. pc6h.sADCUnits=32*ones(1, 16*8); % fread(fid,16*8,'char'); % 8char % 602 user units for adc (set to spaces)
  106. pc6h.fADCProgrammableGain=ones(1,16); % fread(fid,16,'float'); % 730 adc programmable gain (read it or set to 1)
  107. pc6h.fADCDisplayAmplification=ones(1,16); % fread(fid,16,'float'); % 794 (set to 1: array)
  108. pc6h.fADCDisplayOffset=zeros(1,16); % fread(fid,16,'float'); % 858 (set to 0: array)
  109. pc6h.fInstrumentScaleFactor=ones(1,16); % fread(fid,16,'float'); % 922 (set to 1: array)
  110. pc6h.fInstrumentOffset=zeros(1, 16); % fread(fid,16,'float'); % 986 (set to 0 array)
  111. pc6h.fSignalGain=ones(1,16); % fread(fid,16,'float'); % 1050 (set to 1 array)
  112. pc6h.fSignalOffset=zeros(1,16); % fread(fid,16,'float'); % 1114 (set to 0 array)
  113. pc6h.fSignalLowpassFilter=10000*ones(1,16); % fread(fid,16,'float'); % 1178 (set to 100000 array)
  114. pc6h.fSignalLowpassFilter(1)=50000;
  115. pc6h.fSignalHighpassFilter=ones(1,16); % fread(fid,16,'float'); % 1242 (set to 0 array)
  116. pc6h.sDACChannelName=32*ones(1, 4*10); % fread(fid,4*10,'char'); % 1306 (set to spaces)
  117. pc6h.sDACChannelUnits=32*ones(1, 4*8); % fread(fid,4*8,'char'); % 8char % 1346 (set to spaces)
  118. pc6h.fDACScaleFactor=[1000 10 20 20]; % fread(fid,4,'float'); % 1378 (dac channel gains: set to 1)
  119. pc6h.fDACHoldingLevel=[0 0 0 0]; % fread(fid,4,'float'); % 1394 (set to 0)
  120. pc6h.nSignalType=0; % fread(fid,1,'short'); % 12char % 1410 (set to 0 for no signal conditioner)
  121. pc6h.sUnused1412=zeros(1,10); % fread(fid,10,'char'); % 10char % 1412
  122. % synchronous timer outputs
  123. pc6h.nOUTEnable=0; % fread(fid,1,'short'); % 1422 % set to 0
  124. pc6h.nSampleNumberOUT1=0; % fread(fid,1,'short'); % 1424 % set to 0
  125. pc6h.nSampleNumberOUT2=0; % fread(fid,1,'short'); % 1426 % set to 0
  126. pc6h.nFirstEpisodeOUT=0; % fread(fid,1,'short'); % 1428 % set to 0
  127. pc6h.nLastEpisodeOUT=0; % fread(fid,1,'short'); % 1430 % set to 0
  128. pc6h.nPulseSamplesOUT1=0; % fread(fid,1,'short'); % 1432 % set to 0
  129. pc6h.nPulseSamplesOUT2=0; % fread(fid,1,'short'); % 1434 % set to 0
  130. %Epoch waveform and pulses
  131. pc6h.nDigitalEnable=1; % fread(fid,1,'short'); % 1436 % set to 1
  132. pc6h.nWaveformSource=1; % fread(fid,1,'short'); % 1438 % set to 1
  133. pc6h.nActiveDACChannel=0; % fread(fid,1,'short'); % 1440 % set to 0
  134. pc6h.nInterEpisodeLevel=0; % fread(fid,1,'short'); % 1442 % set to 0
  135. pc6h.nEpochType=zeros(1,10); % fread(fid,10,'short'); % 1444 % set to 0
  136. pc6h.fEpochInitLevel=zeros(1,10); % fread(fid,10,'float'); % 1464 % set to 0
  137. pc6h.fEpochLevelInc=zeros(1,10); % fread(fid,10,'float'); % 1504 % set to 0
  138. pc6h.nEpochInitDuration=zeros(1,10); % fread(fid,10,'short'); % 1544 % set to 0
  139. pc6h.nEpochDurationInc=zeros(1,10); % fread(fid,10,'short'); % 1564 % set to 0
  140. pc6h.nDigitalHolding=15; % fread(fid,1,'short'); % 1584 % set to 0
  141. pc6h.nDigitalInterEpisode=0; % fread(fid,1,'short'); % 1586 % set to 0
  142. pc6h.nDigitalValue=zeros(1,10); % fread(fid,10,'short'); % 1588 ^% set to 0
  143. pc6h.fWaveformOffset=0; % fread(fid,1,'float'); % 1608 % set to 0
  144. pc6h.sUnused1612=zeros(1,8); % fread(fid,8,'char'); % 8char % 1612
  145. % DAC output file
  146. pc6h.fDACFileScale=1; % fread(fid,1,'float'); % 1620 % set to 1
  147. pc6h.fDACFileOffset=0; % fread(fid,1,'float'); % 1624 % set to 0
  148. pc6h.sUnused1628=zeros(1,2); % fread(fid,2,'char'); % 2char % 1628 % unused
  149. pc6h.nDACFileEpisodeNum=0; % fread(fid,1,'short'); % 1630 set to 0
  150. pc6h.nDACFileADCNum=0; % fread(fid,1,'short'); % 1632 set to 0
  151. pc6h.sDACFileName=32*ones(1, 12); % fread(fid,12,'char'); % 12char % 1634 % set to spaces
  152. pc6h.sDACFilePath=32*ones(1, 60); % fread(fid,60,'char'); % 60char % 1646 set to spaces
  153. pc6h.sUnused1706=32+zeros(1,12); % fread(fid,12,'char'); % 12char % 1706
  154. % Conditioning pulse train
  155. pc6h.nConditEnable=0; % fread(fid,1,'short'); % 1718 % set to 0
  156. pc6h.nConditChannel=0; % fread(fid,1,'short'); % 1720 0
  157. pc6h.lConditNumPulses=1; % fread(fid,1,'int'); % 1722 0
  158. pc6h.fBaselineDuration=1; % fread(fid,1,'float'); % 1726 0
  159. pc6h.fBaselineLevel=0; % fread(fid,1,'float'); % 1730 0
  160. pc6h.fStepDuration=1; % fread(fid,1,'float'); % 1734 0
  161. pc6h.fStepLevel=0; % fread(fid,1,'float'); % 1738 0
  162. pc6h.fPostTrainPeriod=0; % fread(fid,1,'float'); % 1742 0
  163. pc6h.fPostTrainLevel=0; % fread(fid,1,'float'); % 1746 0
  164. pc6h.sUnused1750=zeros(1,12); % fread(fid,12,'char'); % 12char % 1750 0
  165. % variable parameter user list
  166. pc6h.nParamToVary=0; % fread(fid,1,'short'); % 1762 % set to 0
  167. pc6h.sParamValueList=32+zeros(1,80); % fread(fid,80,'char'); % 80char % 1764 % set to 0
  168. % statistics measurement
  169. pc6h.nAutopeakEnable=1; % fread(fid,1,'short'); % 1844 % set to 0
  170. pc6h.nAutopeakPolarity=1; % fread(fid,1,'short'); % 1846 % set to 0
  171. pc6h.nAutopeakADCNum=0; % fread(fid,1,'short'); % 1848 % set to 0
  172. pc6h.nAutopeakSearchMode=2; % fread(fid,1,'short'); % 1850 % set to -1
  173. pc6h.lAutopeakStart=0; % fread(fid,1,'int'); % 1852 % set to 0
  174. pc6h.lAutopeakEnd=0; % fread(fid,1,'int'); % 1856 % set to 0
  175. pc6h.nAutopeakSmoothing=1; % fread(fid,1,'short'); % 1860 % set to 3
  176. pc6h.nAutopeakBaseline=1; % fread(fid,1,'short'); % 1862 % set to =2
  177. pc6h.nAutopeakAverage=0; % fread(fid,1,'short'); % 1864 % set to 0
  178. pc6h.sUnused1866=zeros(1,14); % fread(fid,14,'char'); % 14char % 1866
  179. % Channel arithmetic
  180. pc6h.nArithmeticEnable=0; % fread(fid,1,'short'); % 1880 % % set to 0
  181. pc6h.fArithmeticUpperLimit=100; % fread(fid,1,'float'); % 1882 0
  182. pc6h.fArithmeticLowerLimit=-100; % fread(fid,1,'float'); % 1886 0
  183. pc6h.nArithmeticADCNumA=0; % fread(fid,1,'short'); % 1890 0
  184. pc6h.nArithmeticADCNumB=0; % fread(fid,1,'short'); % 1892 0
  185. pc6h.fArithmeticK1=1; % fread(fid,1,'float'); % 1894 0
  186. pc6h.fArithmeticK2=0; % fread(fid,1,'float'); % 1898 0
  187. pc6h.fArithmeticK3=1; % fread(fid,1,'float'); % 1902 0
  188. pc6h.fArithmeticK4=0; % fread(fid,1,'float'); % 1906 0
  189. pc6h.sArithmeticOperator='+ '; %fread(fid,2,'char'); % 2char % 1910 '+'
  190. pc6h.sArithmeticUnits=32*ones(1, 8); %fread(fid,8,'char'); % 8char % 1912 % spaces
  191. pc6h.fArithmeticK5=0; % fread(fid,1,'float'); % 1920 0
  192. pc6h.fArithmeticK6=0; % fread(fid,1,'float'); % 1924 0
  193. pc6h.nArithmeticExpression=0; % fread(fid,1,'short'); % 1928 set to 1
  194. pc6h.sUnused1930=[0,0]; % fread(fid,2,'char'); % 2char % 1930
  195. % Online subtraction
  196. pc6h.nPNEnable=0; % fread(fid,1,'short'); % 1932 % set to 0
  197. pc6h.nPNPosition=0; % fread(fid,1,'short'); % 1934 % set to 0
  198. pc6h.nPNPolarity=1; % fread(fid,1,'short'); % 1936 % set to -1
  199. pc6h.nPNNumPulses=2; % fread(fid,1,'short'); % 1938 set to 1
  200. pc6h.nPNADCNum=0; % fread(fid,1,'short'); % 1940 set to 1
  201. pc6h.fPNHoldingLevel=0; % fread(fid,1,'float'); % 1942 set to 0
  202. pc6h.fPNSettlingTime=0; % fread(fid,1,'float'); % 1946 set to 1
  203. pc6h.fPNInterpulse=0; % fread(fid,1,'float'); % 1950 set to 1
  204. pc6h.sUnused1954=zeros(1,12); % fread(fid,12,'char'); % 12char % 1954
  205. % Miscellaneous elements placed in "unused space at end of header block"
  206. pc6h.nListEnable=0; % fread(fid,1,'short'); % 1966 set to 0
  207. pc6h.sUnused1966=zeros(1,80); % fread(fid,80,'char'); % 80char % 1968 set to 0's