mergeNSxNEVSeries.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. %
  2. % mergeNSxNEV()
  3. %
  4. % This function loads two NSx and NEV files and it will combine them
  5. % together into one file. The resulting file will be saved as new NSx
  6. % and NEV files onto the disk. To combine two NSx and NEV files into
  7. % indivual NSx and NEV variables in MATLAB see combineNSxNEV. The time
  8. % difference between the two sets of recordings is removed. To determine
  9. % the time differnce between the two data files, use
  10. % NSx.MetaTags.DateTimeRaw or NEV.MetaTags.DateTimeRaw variables.
  11. %
  12. %
  13. % filename1: The name of the first NSx file. This input is optional. In
  14. % its absense, a dialog will open and will prompt the user to
  15. % select an NSx file.
  16. % (OPTIONAL)
  17. %
  18. % filename2: The name of the second NSx file. This input is also
  19. % optional. In its absense, a dialog will open and will
  20. % prompt the user to select an NSx file.
  21. % (OPTIONAL)
  22. %
  23. % Example:
  24. %
  25. % mergeNSxNEV('c:\data\saveddata1.ns5', 'c:\data\saveddata2.ns5');
  26. %
  27. % The above example reads the two files (full path needed)
  28. % c:\data\saveddata1.ns5 and c:\data\saveddata2.ns5 and their corresponding
  29. % NEV files (saveddata1.nev and saveddata2.nev) in the same folder and
  30. % merges them into a single file called firstrecording001-combined.ns2
  31. % and firstrecording001-combined.nev.
  32. %
  33. % Kian Torab
  34. % kian@blackrockmicro.com
  35. % Blackrock Microsystems
  36. % Version 1.0.0.0
  37. % March 31, 2014
  38. %
  39. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  40. % Version History
  41. %
  42. % 1.0.0.0:
  43. % - Initial release.
  44. %
  45. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  46. function mergeNSxNEV(varargin)
  47. if nargin >= 1
  48. disp('Too many input arguments.');
  49. return;
  50. end
  51. %% Opening the file
  52. % Getting the name of the first file from the user
  53. [gfFileName gfPathName] = getFile;
  54. [filePath, fileName, fileExt] = fileparts(gfFileName);