A dirty solution that seems to work is to save the command window text in a cell array of strings and then use cell2mat. I.e. last line in above code replaced by:
clc
evalrasmolscript(handles.mv,'print {selected}.xyz')
c = command_window_text(1); % File exchange function
xyz = cell2mat(eval(c{1}));
(I tried using evalc instead of command_window_text, but for some reason the information sent by jmol to the command window is not read by neither evalc nor diary)