Thanks so much Dee and Mario, I really appreciate your advice.
Yes, the other mex files working ok. And I tried the workarounds that gabrielino00 and gholland suggested in the previous thread but they didn’t work for me:
It turned out to be the same issue that Han was having before:
KbDemo is picking up the escape key ok (and therefore the touchbar) but not the keyboard. Setting KbWait() to KbWait(-1) fixes this, but the workaround in psychtoolbox doesn’t seem to be working for me with Catalina.
Thanks so much for you both for all your help on this, I really appreciate it,