Ok, success! Recovery can be solved by restarting the joystick within the catch-statement of a try-catch block. Does anyone have insight into why this is happening and/or how to prevent it?
function MWE
figure('CloseRequestFcn','delete(timerfind); delete(gcf);');
a = axes('XLim',[-1,1],'YLim',[-1,1],'NextPlot','replacechildren');
j = vrjoystick(1);
t = timer('ExecutionMode','fixedRate','Period',0.01,'TimerFcn',@t_Callback);
start(t);
function t_Callback(~,~)
try
[position,~,~] = read(j);
catch
j = vrjoystick(1);
return;
end
plot(a,position(1),position(2),'ko');
end
end