JA_interim_feedback.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. function [Par] = JA_interim_feedback(Par)
  2. % it presents interim feedback about catch responses/no_responses, too fast and too slow responses
  3. CF_screen_position = Par.screen_dimensions(3:4)/2;
  4. SBJ_screen_position = [0 Par.screen_dimensions(4)/2];
  5. %% check CF's "performance" first
  6. switch Par.final_design.Type{Par.tr}
  7. case {'slow_tr', 'fast_tr'}
  8. text_CF.string = '';
  9. text_CF.color = [0 0 0];
  10. case 'out_slow'
  11. text_CF.string = 'prova ad essere \n pi? veloce!';
  12. text_CF.color = [1 0 0];
  13. case 'out_fast'
  14. text_CF.string = 'aspetta il colore \n prima di muoverti!';
  15. text_CF.color = [1 0 0];
  16. case 'ok_catch'
  17. text_CF.string = 'ottimo!';
  18. text_CF.color = [0 1 0];
  19. case 'failed_catch'
  20. text_CF.string = 'presta \n attenzione!';
  21. text_CF.color = [1 0 0];
  22. end
  23. %% if it is a catch trial
  24. if strcmp(Par.final_design.Type{Par.tr}, 'ok_catch') || strcmp(Par.final_design.Type{Par.tr}, 'failed_catch')
  25. switch Par.SBJ_classification{Par.tr}
  26. case 'no_response' % correct
  27. text_SBJ.string = 'ottimo!'
  28. text_SBJ.color = [0 1 0];
  29. Par.SBJ_RT{Par.tr} = [];
  30. otherwise % not correct (it implies a movement)
  31. text_SBJ.string = 'presta \n attenzione!';
  32. text_SBJ.color = [1 0 0];
  33. Par.SBJ_RT{Par.tr} = [];
  34. end
  35. else % in the case is a standard trial...produce text output in the following cases
  36. switch Par.final_design.SBJ_performance_Type{Par.tr}
  37. case 'no_response'
  38. text_SBJ.string = 'prova ad essere \n pi? veloce!';
  39. text_SBJ.color = [1 0 0];
  40. Par.SBJ_RT{Par.tr} = Par.SBJ_RT_tmp{Par.tr};
  41. case {'out_fast_press', 'out_fast_lift'}
  42. text_SBJ.string = 'aspetta il colore \n prima di muoverti!';
  43. text_SBJ.color = [1 0 0];
  44. Par.SBJ_RT{Par.tr} = [];
  45. otherwise % in case of lift or press
  46. text_SBJ.string = '';
  47. text_SBJ.color = [0 0 0];
  48. Par.SBJ_RT{Par.tr} = Par.SBJ_RT_tmp{Par.tr};
  49. end
  50. end
  51. %% set texts position
  52. text_CF.position = CF_screen_position;
  53. text_SBJ.position = SBJ_screen_position;
  54. %% draw on the screen with text
  55. Screen('FillRect', Par.window, [0 0 0], Par.screen_dimensions);
  56. Screen('TextSize', Par.window, 30);
  57. DrawFormattedText(Par.window, text_CF.string, text_CF.position(1),...
  58. text_CF.position(2), text_CF.color);
  59. DrawFormattedText(Par.window, text_SBJ.string, text_SBJ.position(1),...
  60. text_SBJ.position(2), text_SBJ.color);
  61. [Par.VBL] = Screen(Par.window, 'Flip');
  62. % is there smthng to show?
  63. if strcmp(text_CF.string, '') && strcmp(text_SBJ.string, '')
  64. % if there is nothing to show, go on fast
  65. WaitSecs(1);
  66. else
  67. % if there is something to show leave it on the screen for 2 seconds
  68. WaitSecs(2);
  69. end