JA_interim_feedback.m 2.9 KB

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