ComputeRegressorsAll.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. % ComputeRegressorsAll.m
  2. %
  3. % This function calls the ComputeRegressors for all the files in the regular
  4. % and saves the regressors in files with _sp.txt and _fix.txt endings
  5. %
  6. % input:
  7. % regex - regular expresion to .arff files
  8. % attName - attribute name to use for intervals extraction
  9. % outDir - dir to save blocks
  10. %
  11. % ex. ComputeRegressorsAll('eye_movement_type', 'regressors');
  12. function ComputeRegressorsAll(attName, outDir)
  13. subIds = {'01'; '02'; '03'; '04'; '05'; '06'; '09'; '10'; '14'; '15'; '16'; '17'; '18'; '19'; '20'};
  14. saccShare = [0.1236; 0.0880; 0.0870; 0.1156; 0.0073; 0.1347; 0.0713; 0.1085; 0.0477; 0.1147; 0.0837; 0.0680; 0.1040; 0.0581; 0.0476];
  15. spShare = [ 0.1074; 0.1915; 0.1859; 0.1554; 0.0094; 0.1536; 0.1928; 0.1810; 0.1901; 0.1368; 0.1309; 0.1207; 0.1152; 0.1741; 0.1201];
  16. for subInd=1:size(subIds,1)
  17. regex = ['../gaze_data_with_em/run-*/sub-' subIds{subInd,1} '*_ses-movie_task-movie_run-*_converted.arff'];
  18. arffFiles = glob(regex);
  19. spExt = '_sp.txt';
  20. saccExt = '_sacc.txt';
  21. for i=1:size(arffFiles,1)
  22. arffFile = arffFiles{i,1};
  23. [dir, base, ext] = fileparts(arffFile);
  24. disp(arffFile)
  25. [start, duration, spValues, saccValues] = ComputeRegressors(arffFile, attName, saccShare(subInd), spShare(subInd));
  26. spSaveFile = [outDir '/' base spExt];
  27. dlmwrite(spSaveFile, [start duration spValues], 'precision', 10);
  28. saccSaveFile = [outDir '/' base saccExt];
  29. dlmwrite(saccSaveFile, [start duration saccValues], 'precision', 10);
  30. end
  31. end
  32. end