create_data_matlab_blackrock.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. %This script creates a mat file with spikes and LFP channels 1-8 of one
  2. %data set supplied by Blackrock Microsystems that conforms to File
  3. %Specification 2.3.
  4. %
  5. %The matlab code for loading data was originally provided through Blackrock
  6. %Microsystems and was slightly modified.
  7. %TODO: Update to newer versions of matlab file loaders provided by Blackrock.
  8. %
  9. %The result FileSpec2.3001.mat is used in the IO test :
  10. % test_compare_blackrockio_with_matlabloader_V23
  11. %
  12. %Contents of data file:
  13. %Raw recording on Channels 1-8
  14. %Spike signal on Odd Channels (1-7)
  15. %Recording on Analong Inputs 1 and 2
  16. %Signal on Analog Input 2
  17. %Three Comments Approximately 10 Seconds Apart
  18. %Intermittent and Randomized Digital Signal
  19. %No Serial Data
  20. %No Tracking Data
  21. openNEV('../FileSpec2.3001.nev','read','e:1','u:0','nosave','noparse');
  22. openNSx('../FileSpec2.3001.ns5','e:1:8','read');
  23. %get unit data
  24. ts=NEV.Data.Spikes.Timestamps;
  25. el=NEV.Data.Spikes.Electrode;
  26. un=NEV.Data.Spikes.Unit;
  27. wf=NEV.Data.Spikes.Waveform;
  28. %load LFP matrix
  29. lfp=NS5.Data;
  30. %select units on el. 1-7
  31. ts=ts(el>=1 & el<=7);
  32. un=un(el>=1 & el<=7);
  33. el=el(el>=1 & el<=7);
  34. %marker
  35. mts=NEV.Data.SerialDigitalIO.TimeStamp;
  36. mid=NEV.Data.SerialDigitalIO.UnparsedData;
  37. save('../FileSpec2.3001.mat','lfp','ts','el','un','wf','mts','mid');