Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

splitNEVNTrode.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. function splitNEVNTrode
  2. % splitNEVNTrode
  3. %
  4. % Opens and splits an NEV file based on its NTrode groups. It depends on
  5. % openCCF file.
  6. %
  7. % Use splitNEVNTrode
  8. %
  9. % This function does not take any inputs.
  10. %
  11. % Example 1:
  12. % splitNEVNTrode;
  13. %
  14. % In the example above, the user will be prompted to select a CCF file
  15. % first. The CCF contains the ntrode grouping infromation. Then the user
  16. % will be prompted to select a NEV file. The script will then split the
  17. % NEV file into smaller NEV files containing channels in given ntrode
  18. % groups. For example, if ntrode group one consists of channels 1,3,5,
  19. % and 12, then using splitNEVNTrode will split the file into a smaller
  20. % NEV files that contains those channels only. If there are multiple
  21. % ntrodes then the files will split into multiple smaller files, equal in
  22. % number of the ntrode groups.
  23. %
  24. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  25. % Kian Torab
  26. % support@blackrockmicro.com
  27. % Blackrock Microsystems
  28. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  29. % Version History
  30. %
  31. % 1.0.0.0: January 18, 2016
  32. % - Initial release.
  33. %
  34. % 1.1.0.0: October 10, 2016 - Saman Hagh Gooie
  35. % - Bug fixes with file loading
  36. % - Fixed the file extension used for saving
  37. %
  38. % 1.2.0.0: October 27, 2020
  39. % - Removed junk characters from the file.
  40. %
  41. % 1.2.1.0: November 17, 2020
  42. % - Minor bug fixes and general code clean up - @David Kluger
  43. %
  44. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  45. % Validating input parameter
  46. ccf = openCCF;
  47. splitCount = unique(ccf.NTrodeInfo.NTrodeID);
  48. splitCount = splitCount(splitCount>0);
  49. % Getting the file name
  50. if ~ismac
  51. [fname, path] = getFile('*.nev', 'Choose an NEV file...');
  52. else
  53. [fname, path] = getFile('*.nev', 'Choose an NEV file...');
  54. end
  55. if fname == 0
  56. disp('No file was selected.');
  57. if nargout
  58. clear variables;
  59. end
  60. return;
  61. end
  62. % Loading the file
  63. for idx = splitCount
  64. % Determining whether tetrode channel is recorded and valid in NSx
  65. tetrodeChannels = ccf.NTrodeInfo.NTrodeMembers{idx};
  66. NEV = openNEV([path, fname(1:end-4) '.nev'], ['c:' num2str(tetrodeChannels)]); % modified by SH 05-Oct-2016
  67. newFileName = [path fname(1:end-4) '-tet' sprintf('%03d', idx) fname(end-3:end)];
  68. saveNEV(NEV, newFileName, 'noreport');
  69. end