openCCF.m 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. function [infoPackets, version] = openCCF(filename)
  2. % openCCF
  3. %
  4. % This script reads a .ccf file and outputs it in a structure.
  5. %
  6. % filename: Name of the file to be opened. If the fname is omitted
  7. % the user will be prompted to select a file.
  8. % DEFAULT: Will open Open File UI.
  9. %
  10. % Channels 1-128 are neural channels
  11. % Channels 129-144 are external analog inputs
  12. % Channels 145-148 are external analog outpus
  13. % Channels
  14. %
  15. % Kian Torab
  16. % kian@blackrockmicro.com
  17. % Blackrock Microsystems
  18. % Version 2.1.0.0
  19. %
  20. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  21. % Version History
  22. %
  23. % 1.0.0.0:
  24. % - Initial release.
  25. %
  26. % 1.2.3.0:
  27. % - Minor bug fix that led to a crash in certain cases.
  28. %
  29. % 1.2.4.0:
  30. % - Minor bug fix regarding passing a filename variable to the function.
  31. %
  32. % 2.0.0.0:
  33. % - Implemented XML CCF file format.
  34. %
  35. % 2.1.0.0:
  36. % - Fixed a bug in loading nTrode groups with a base of 0.
  37. %
  38. % 2.2.0.0 April 29, 2020
  39. % - Fixed an error where N-Trodes with less than 4 members read an extra
  40. % 1 as the extra non-existent members.
  41. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  42. infoPackets.openCCFVersion = '2.1.0.0';
  43. %% Parameters
  44. % Which versions of .ccf's are supported
  45. supportedVersions = {'3.6', '3.7', '3.8', '3.9'};
  46. % Number of cbPKT_CHANINFO packets to read in the file
  47. nValidPKT_CHANINFO = 160;
  48. if( nargin ~= 1 )
  49. [filename, pathname] = getFile('*.ccf');
  50. if ~filename
  51. disp('No file was selected.');
  52. return;
  53. end
  54. fullfilename = [pathname filename];
  55. elseif (nargin == 1)
  56. fullfilename = filename;
  57. else
  58. if strcmpi(filename, 'ver')
  59. disp(['Version is ' infoPackets.openCCFVersion]);
  60. infoPackets = [];
  61. return;
  62. end
  63. end
  64. %% Open file
  65. [fid, message] = fopen( fullfilename, 'rb', 'l');
  66. if( fid == -1 ),
  67. warning(['Unable to open file: ' fullfilename '. Error message ' message]);
  68. return;
  69. end;
  70. %% Read header incl. version
  71. head = fread(fid, 16, 'uint8=>char*1' )';
  72. if strcmp(head(1:5), 'cbCCF')
  73. version = deblank(strtrim(head(6:end))); % Strip possible leading space and trailing nulls
  74. elseif strcmp(head(1:5), '<?xml')
  75. version = '3.9';
  76. else
  77. warning('Not a well-formed .ccf file');
  78. fclose(fid);
  79. return;
  80. end
  81. % Save version info in the structure.
  82. infoPackets.Version = version;
  83. % Verify to see if the file version is supported
  84. if ~ismember(version, supportedVersions)
  85. warning(sprintf('Unsupported file version: %s', version));
  86. fclose(fid);
  87. return;
  88. end
  89. if strcmpi(version, '3.9')
  90. infoPackets = parseCCF(fullfilename);
  91. for nTrodeIDX = 1:length(infoPackets.Children(7).Children)
  92. for trodeIDX = 1:str2double(infoPackets.Children(7).Children(nTrodeIDX).Children(7).Children.Data)
  93. tempTrodes(trodeIDX) = ...
  94. str2double(infoPackets.Children(7).Children(nTrodeIDX).Children(9).Children(trodeIDX).Children.Data) + 1;
  95. end
  96. if ~isempty(tempTrodes)
  97. infoPackets.NTrodeInfo.NTrodeID(nTrodeIDX) = nTrodeIDX;
  98. infoPackets.NTrodeInfo.NTrodeMembers{nTrodeIDX} = tempTrodes;
  99. end
  100. tempTrodes = [];
  101. end
  102. return;
  103. end
  104. %% Read packets
  105. for p = 1:nValidPKT_CHANINFO
  106. if p == 128
  107. % disp('w');
  108. end
  109. infoPackets.ChanInfo(p) = readInfoPacket(fid, version);
  110. end
  111. infoPackets.AdaptiveFilterInfo = readAdapFilterPacket(fid);
  112. infoPackets.SortingInfo = readSortingPacket(fid);
  113. infoPackets.SystemInfo = []; %readSystemInfoPacket(fid);
  114. infoPackets.NTrodeInfo = readNTrodeInfoPacket(infoPackets);
  115. %% Close file
  116. fclose(fid);
  117. function p = readInfoPacket(fid, version)
  118. % Read a cbPKT_CHANINFO packet
  119. p = [];
  120. cbLEN_STR_LABEL = 16;
  121. cbMAXUNITS = 5;
  122. cbMAXHOOPS = 4;
  123. p.SystemClockTimestamp = fread(fid, 1, '*uint32');
  124. p.Child = fread(fid, 1, '*uint16');
  125. p.AnaInPacketType = fread(fid, 1, '*uint8');
  126. p.SystemDataLength = fread(fid, 1, '*uint8');
  127. p.AnaInChannelID = fread(fid, 1, '*uint32');
  128. p.AnaInChannelProcessor = fread(fid, 1, '*uint32');
  129. p.AnaInBankID = fread(fid, 1, '*uint32');
  130. p.AnaInPinID = fread(fid, 1, '*uint32');
  131. h = fread(fid, 1, '*uint32');
  132. p.CapabilitiesGeneralChannel = setFlagsCBCHAN(h);
  133. h = fread(fid, 1, '*uint32');
  134. p.CapabilitiesDigOutChannel = setFlagsCBDOUT(h);
  135. h = fread(fid, 1, '*uint32');
  136. p.CapabilitiesDigInChannel = setFlagsCBDINP(h);
  137. h = fread(fid, 1, '*uint32');
  138. p.CapabilitiesAnaOutChannel = setFlagsCBAOUT(h);
  139. h = fread(fid, 1, '*uint32');
  140. p.CapabilitiesAnaInChannel = setFlagsCBAINP(h);
  141. p.CapabilitiesSpikeProcessing = fread(fid, 1, '*uint32');
  142. p.InputPhysicalChannelScalingInfo = readCbScaling(fid);
  143. p.InputPhysicalChannelFilterDefinition = readFiltDesc(fid);
  144. p.OutputPhysicalChannelScalingInfo = readCbScaling(fid);
  145. p.OutputPhysicalChannelFilterDefinition = readFiltDesc(fid);
  146. p.ChannelLabel = fread(fid, cbLEN_STR_LABEL, '*char*1')';
  147. p.ChannelUserFlags = fread(fid, 1, '*uint32');
  148. p.ChannelPosition = fread(fid, 4, '*int32')';
  149. p.InputPhysicalChannelScalingInfoCustom = readCbScaling(fid);
  150. p.OuputPhysicalChannelScalingInfoCustom = readCbScaling(fid);
  151. p.doutopts = fread(fid, 1, '*uint32');
  152. p.dinpopts = fread(fid, 1, '*uint32');
  153. p.aoutopts = fread(fid, 1, '*uint32');
  154. p.eopchar = fread(fid, 1, '*uint32');
  155. % Below two lines are actually part of a union, not sure how to figure out
  156. % which option is actually being used
  157. p.AnaInMonitorChannelAddress = fread(fid, 1, '*uint32');
  158. p.AnaInOutputValue = fread(fid, 1, '*int32');
  159. p.AnaInOptions = fread(fid, 1, '*uint32');
  160. p.AnaInLNCAdaptationRate = fread(fid, 1, '*uint32');
  161. p.AnaInContinuousStreamFilterID = fread(fid, 1, '*uint32');
  162. p.AnalogInputContinuousStreamSampleGroup = fread(fid, 1, '*uint32');
  163. p.AnaInContinuousStreamDisplayFactorMin = fread(fid, 1, '*int32');
  164. p.AnaInContinuousStreamDisplayFactorMax = fread(fid, 1, '*int32');
  165. p.AnaInSpikeStreamFilterID = fread(fid, 1, '*uint32');
  166. p.AnaInSpikeStreamDisplayFactorMax = fread(fid, 1, '*int32');
  167. p.AnaInLNCDisplayFactorMax = fread(fid, 1, '*int32');
  168. p.AnaInSpikeProcessingOptions = fread(fid, 1, '*uint32');
  169. p.AnaInSpikeStreamThresholdLevel = fread(fid, 1, '*int32');
  170. p.AnaInSpikeStreamThresholdLimit = fread(fid, 1, '*int32');
  171. p.AnaInNTrodeGroupID = fread(fid, 1, '*uint32');
  172. p.AnaInAmplitudeRejectionValuePositive = fread(fid, 1, '*int16');
  173. p.AnaInAmplitudeRejectionValueNegative = fread(fid, 1, '*int16');
  174. p.AnaInDigitalReferencingChannel = fread(fid, 1, '*uint32');
  175. p.AnaInManualMappingUnit = readCbManualUnitMappings(fid, cbMAXUNITS, version);
  176. p.AnaInSpikeHoopsSorting = readCbHoops(fid, cbMAXUNITS, cbMAXHOOPS);
  177. function p = readAdapFilterPacket(fid)
  178. p = [];
  179. p.Time = fread(fid, 1, '*uint32');
  180. p.Child = fread(fid, 1, '*uint16');
  181. p.Type = fread(fid, 1, '*uint8');
  182. p.DataLength = fread(fid, 1, '*uint8');
  183. p.Chan = fread(fid, 1, '*uint32');
  184. p.Mode = fread(fid, 1, '*uint32');
  185. p.LearningRate = fread(fid, 1, '*float32');
  186. p.RefChan1 = fread(fid, 1, '*uint32');
  187. p.RefChan2 = fread(fid, 1, '*uint32');
  188. function p = readSortingPacket(fid)
  189. p = [];
  190. p.Time = fread(fid, 1, '*uint32');
  191. p.Child = fread(fid, 1, '*uint16');
  192. p.Type = fread(fid, 1, '*uint8');
  193. p.DataLength = fread(fid, 1, '*uint8');
  194. p.NumMaxSimultChans = fread(fid, 1, '*uint32');
  195. p.RefractoryPeriodInSamples = fread(fid, 1, '*uint32');
  196. function p = readSystemInfoPacket(fid)
  197. p = [];
  198. function p = readNTrodeInfoPacket(infoPackets)
  199. p = [];
  200. NTrodeGroups = unique([infoPackets.ChanInfo.AnaInNTrodeGroupID]); NTrodeGroups(1) = [];
  201. NTrodeGroupsCount = length(NTrodeGroups);
  202. for ntrodeIDX = 1:NTrodeGroupsCount
  203. p.NTrodeID(ntrodeIDX) = NTrodeGroups(ntrodeIDX);
  204. p.NTrodeMembers{ntrodeIDX} = find([infoPackets.ChanInfo.AnaInNTrodeGroupID] == ntrodeIDX);
  205. end
  206. %% Sub-struct readers
  207. function sc = readCbScaling(fid)
  208. % Read a cbSCALING struct
  209. cbLEN_STR_UNIT = 8;
  210. sc.AnalogChannelScaleMin = fread(fid, 1, '*int16');
  211. sc.AnalogChannelScaleMax = fread(fid, 1, '*int16');
  212. sc.AnalogChannelScaleMin = fread(fid, 1, '*int32');
  213. sc.AnalogChannelScaleMax = fread(fid, 1, '*int32');
  214. sc.AnalogChannelGain = fread(fid, 1, '*int32');
  215. sc.AnalogChannelUnit = fread(fid, cbLEN_STR_UNIT, '*char*1')';
  216. function fd = readFiltDesc(fid)
  217. % Read a cbFILTDESC struct
  218. cbLEN_STR_FILT_LABEL = 16;
  219. fd.FilterLabel = fread(fid, cbLEN_STR_FILT_LABEL, '*char*1')';
  220. fd.FilterHighPassFrequency = fread(fid, 1, '*uint32');
  221. fd.FilterHighPassOrder = fread(fid, 1, '*uint32');
  222. fd.FilterHighPassType = fread(fid, 1, '*uint32');
  223. fd.FilterLowPassFrequency = fread(fid, 1, '*uint32');
  224. fd.FilterLowPassOrder = fread(fid, 1, '*uint32');
  225. fd.FilterLowPassType = fread(fid, 1, '*uint32');
  226. function ums = readCbManualUnitMappings(fid, maxUnits, version)
  227. % Loop to read all the cbMANUALUNITMAPPING packets. Note that this requires
  228. % knowing the file version: v3.6 is different from 3.7 and 3.8
  229. % Loop growing is inefficient, but it's just not that much data.
  230. if strcmp(version, '3.6')
  231. for i = 1:maxUnits
  232. ums(i) = readCbManualUnitMapping3_6(fid);
  233. end
  234. else
  235. for i = 1:maxUnits
  236. ums(i) = readCbManualUnitMapping(fid);
  237. end
  238. end
  239. function um = readCbManualUnitMapping(fid)
  240. % Read a cbMANUALUNITMAPPING packet for a v3.7 or 3.8 file
  241. um.nOverride = fread(fid, 1, '*int16');
  242. um.afOrigin = fread(fid, 3, '*int16')';
  243. um.afShape = fread(fid, [3 3], '*int16')';
  244. um.aPhi = fread(fid, 1, '*int16')';
  245. um.bValid = fread(fid, 1, '*uint32')';
  246. function um = readCbManualUnitMapping3_6(fid)
  247. % Read a cbMANUALUNITMAPPING packet for a v3.6 file
  248. um.nOverride = fread(fid, 1, '*uint32');
  249. um.afOrigin = fread(fid, 3, '*float32')';
  250. um.afShape = fread(fid, [3 3], '*float32')';
  251. um.aPhi = fread(fid, 1, '*float32')';
  252. um.bValid = fread(fid, 1, '*uint32')';
  253. function hs = readCbHoops(fid, maxUnits, maxHoops)
  254. % Loop to read the cbHOOP packets
  255. % Loop growing is inefficient, but it's just not that much data.
  256. for u = 1:maxUnits
  257. for h = 1:maxHoops
  258. hs(u, h) = readCbHoop(fid);
  259. end
  260. end
  261. function h = readCbHoop(fid)
  262. % Read a cbHOOP packet
  263. h.valid = fread(fid, 1, '*uint16')';
  264. h.time = fread(fid, 1, '*int16')';
  265. h.min = fread(fid, 1, '*int16')';
  266. h.max = fread(fid, 1, '*int16')';
  267. function h = setFlagsCBCHAN(flags)
  268. binaryValue = dec2bin(flags,12);
  269. % define constants
  270. h.ChanExists = 0; % Channel id is allocated
  271. h.ChanConnected = 0; % Channel is connected and mapped and ready to use
  272. h.ChanIsolated = 0; % Channel is electrically isolated
  273. h.ChanType = '';
  274. if strcmpi(binaryValue(1), '1')
  275. h.ChanType = 'DigitalOut';
  276. end
  277. if strcmpi(binaryValue(2), '1')
  278. h.ChanType = 'DigitalInput';
  279. end
  280. if strcmpi(binaryValue(3), '1')
  281. h.ChanType = 'AnalogOutput';
  282. end
  283. if strcmpi(binaryValue(4), '1')
  284. h.ChanType = 'AnalogInput';
  285. end
  286. if strcmpi(binaryValue(10), '1')
  287. h.ChanIsolated = 1;
  288. end
  289. if strcmpi(binaryValue(11), '1')
  290. h.ChanConnected = 1;
  291. end
  292. if strcmpi(binaryValue(12), '1')
  293. h.ChanExists = 1;
  294. end
  295. function h = setFlagsCBDOUT(flags)
  296. binaryValue = dec2bin(flags,30);
  297. h.BaudRate = 0;
  298. h.NumberOfBits = 0;
  299. h.CanBeManuallyConfigured = 0;
  300. h.TrackMostRecentlySelected = 0;
  301. h.CanOutputFrequency = 0;
  302. h.ChanMonitorUnit0 = 0;
  303. h.ChanMonitorUnit1 = 0;
  304. h.ChanMonitorUnit2 = 0;
  305. h.ChanMonitorUnit3 = 0;
  306. h.ChanMonitorUnit4 = 0;
  307. h.ChanMonitorUnit5 = 0;
  308. h.ChanMonitorUnitAll = 0;
  309. if strcmpi(binaryValue(1:6), '111111')
  310. h.ChanMonitorUnitAll = 1;
  311. else
  312. if strcmpi(binaryValue(1), '1')
  313. h.ChanMonitorUnit5 = 1;
  314. end
  315. if strcmpi(binaryValue(2), '1')
  316. h.ChanMonitorUnit4 = 1;
  317. end
  318. if strcmpi(binaryValue(3), '1')
  319. h.ChanMonitorUnit3 = 1;
  320. end
  321. if strcmpi(binaryValue(4), '1')
  322. h.ChanMonitorUnit2 = 1;
  323. end
  324. if strcmpi(binaryValue(5), '1')
  325. h.ChanMonitorUnit1 = 1;
  326. end
  327. if strcmpi(binaryValue(6), '1')
  328. h.ChanMonitorUnit0 = 1;
  329. end
  330. end
  331. if strcmpi(binaryValue(12), '1')
  332. h.CanOutputFrequency = 1;
  333. end
  334. if strcmpi(binaryValue(13), '1')
  335. h.TrackMostRecentlySelected = 1;
  336. end
  337. if strcmpi(binaryValue(18), '1')
  338. h.CanBeManuallyConfigured = 1;
  339. end
  340. if strcmpi(binaryValue(19), '1')
  341. h.NumberOfBits = 32;
  342. end
  343. if strcmpi(binaryValue(20), '1')
  344. h.NumberOfBits = 16;
  345. end
  346. if strcmpi(binaryValue(21), '1')
  347. h.NumberOfBits = 8;
  348. end
  349. if strcmpi(binaryValue(22), '1')
  350. h.NumberOfBits = 1;
  351. end
  352. if strcmpi(binaryValue(25), '1')
  353. h.BaudRate = 115200;
  354. end
  355. if strcmpi(binaryValue(26), '1')
  356. h.BaudRate = 57600;
  357. end
  358. if strcmpi(binaryValue(27), '1')
  359. h.BaudRate = 38400;
  360. end
  361. if strcmpi(binaryValue(28), '1')
  362. h.BaudRate = 19200;
  363. end
  364. if strcmpi(binaryValue(29), '1')
  365. h.BaudRate = 9600;
  366. end
  367. if strcmpi(binaryValue(30), '1')
  368. h.BaudRate = 2400;
  369. end
  370. function h = setFlagsCBDINP(flags)
  371. binaryValue = dec2bin(flags,22);
  372. h.BaudRate = 0;
  373. h.NumberOfBits = 0;
  374. h.PortReadType = 0;
  375. h.CapturePacketMethod = 0;
  376. h.PortControlsEvent = 0;
  377. if strcmpi(binaryValue(1), '1')
  378. h.PortReadType = '8-bit strobe/8-bit falling edge';
  379. end
  380. if strcmpi(binaryValue(2), '1')
  381. h.PortReadType = '8-bit strobe/8-bit rising edge';
  382. end
  383. if strcmpi(binaryValue(3), '1')
  384. h.PortReadType = '8-bit strobe/8-bit any edge';
  385. end
  386. if strcmpi(binaryValue(4), '1')
  387. h.PortReadType = '8-bit any bit falling edge';
  388. end
  389. if strcmpi(binaryValue(5), '1')
  390. h.PortReadType = '8-bit any bit rising edge';
  391. end
  392. if strcmpi(binaryValue(6), '1')
  393. h.PortControlsEvent = 1;
  394. end
  395. if strcmpi(binaryValue(7), '1')
  396. h.CapturePacketMethod = 'Logic input';
  397. end
  398. if strcmpi(binaryValue(8), '1')
  399. h.CapturePacketMethod = 'Character';
  400. end
  401. if strcmpi(binaryValue(9), '1')
  402. h.CapturePacketMethod = 'Word strob';
  403. end
  404. if strcmpi(binaryValue(10), '1')
  405. h.CapturePacketMethod = 'Any bit change';
  406. end
  407. if strcmpi(binaryValue(11), '1')
  408. h.NumberOfBits = 32;
  409. end
  410. if strcmpi(binaryValue(12), '1')
  411. h.NumberOfBits = 16;
  412. end
  413. if strcmpi(binaryValue(13), '1')
  414. h.NumberOfBits = 8;
  415. end
  416. if strcmpi(binaryValue(14), '1')
  417. h.NumberOfBits = 1;
  418. end
  419. if strcmpi(binaryValue(17), '1')
  420. h.BaudRate = 115200;
  421. end
  422. if strcmpi(binaryValue(18), '1')
  423. h.BaudRate = 57600;
  424. end
  425. if strcmpi(binaryValue(19), '1')
  426. h.BaudRate = 38400;
  427. end
  428. if strcmpi(binaryValue(20), '1')
  429. h.BaudRate = 19200;
  430. end
  431. if strcmpi(binaryValue(21), '1')
  432. h.BaudRate = 9600;
  433. end
  434. if strcmpi(binaryValue(22), '1')
  435. h.BaudRate = 2400;
  436. end
  437. function h = setFlagsCBAOUT(flags)
  438. binaryValue = dec2bin(flags,22);
  439. h.Audio = 0;
  440. h.AnalogScale = 0;
  441. h.ChanFunction = '';
  442. if strcmpi(binaryValue(1), '1')
  443. h.ChanFunction = 'Waveform generator';
  444. end
  445. if strcmpi(binaryValue(2), '1')
  446. h.ChanFunction = 'Monitors spikes';
  447. end
  448. if strcmpi(binaryValue(3), '1')
  449. h.ChanFunction = 'Monitors SMP';
  450. end
  451. if strcmpi(binaryValue(4), '1')
  452. h.ChanFunction = 'Monitors LNC';
  453. end
  454. if strcmpi(binaryValue(5), '1')
  455. h.ChanFunction = 'Monitors raw';
  456. end
  457. if strcmpi(binaryValue(6), '1')
  458. h.AnalogScale = 'Waveform generator';
  459. end
  460. if strcmpi(binaryValue(7), '1')
  461. h.AnalogScale = 'Waveform generator';
  462. end
  463. if strcmpi(binaryValue(8), '1')
  464. h.AnalogScale = 'Waveform generator';
  465. end
  466. if strcmpi(binaryValue(9), '1')
  467. h.Audio = 1;
  468. end
  469. function h = setFlagsCBAINP(flags)
  470. binaryValue = dec2bin(flags,22);
  471. h.Audio = 0;
  472. h.AnalogScale = 0;
  473. h.ChanFunction = '';
  474. if strcmpi(binaryValue(1), '1')
  475. h.ChanFunction = 'Waveform generator';
  476. end
  477. if strcmpi(binaryValue(2), '1')
  478. h.ChanFunction = 'Monitors spikes';
  479. end
  480. if strcmpi(binaryValue(3), '1')
  481. h.ChanFunction = 'Monitors SMP';
  482. end
  483. if strcmpi(binaryValue(4), '1')
  484. h.ChanFunction = 'Monitors LNC';
  485. end
  486. if strcmpi(binaryValue(5), '1')
  487. h.ChanFunction = 'Monitors raw';
  488. end
  489. if strcmpi(binaryValue(6), '1')
  490. h.AnalogScale = 'Waveform generator';
  491. end
  492. if strcmpi(binaryValue(7), '1')
  493. h.AnalogScale = 'Waveform generator';
  494. end
  495. if strcmpi(binaryValue(8), '1')
  496. h.AnalogScale = 'Waveform generator';
  497. end
  498. if strcmpi(binaryValue(9), '1')
  499. h.Audio = 1;
  500. end