readdat.m 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. function [data,sampling]=readdat
  2. %
  3. % function for reading *.mat, *.wav and *.au files
  4. % *.mat files have to contain variables data and sampling in order for the
  5. % returns to work properly
  6. %
  7. [fname,pname]=uigetfile('*.*');
  8. strindex=findstr(fname,'.plx');
  9. if ~isempty(strindex);
  10. error('This file format can be read with Plexon supplied routines in folder ReadingPLXandDDTfilesinMatlab');
  11. end;
  12. strindex=findstr(fname,'.ddt');
  13. if ~isempty(strindex);
  14. error('This file format can be read with Plexon supplied routines in folder ReadingPLXandDDTfilesinMatlab');
  15. end;
  16. strindex=findstr(fname,'.nex');
  17. if ~isempty(strindex);
  18. error('This file format can be read with Plexon supplied routines in folder HowToReadNexFilesInMatlab');
  19. end;
  20. strindex=findstr(fname,'.mat');
  21. if ~isempty(strindex);
  22. eval(['load ' pname fname]);
  23. end;
  24. strindex=findstr(fname,'.wav');
  25. if ~isempty(strindex);
  26. filename=[pname fname];
  27. [data,sampling]=wavread(filename);
  28. end;
  29. strindex=findstr(fname,'.au');
  30. if ~isempty(strindex);
  31. filename=[pname fname];
  32. [data,sampling]=auread(filename);
  33. end;