function [data,status] = mdswtevent(event)

% MDSWTEVENT waits for an MDS event
%   MDSWTEVENT(EVENT) waits for an MDS EVENT and returns the DATA issued by the
%   event emitter and the STATUS.

if nargin < 1, error('Specify the event.'), end
mdsdata('___mdswteventdata = "            "');
status = mdsdata('mdsshr->mds$wtevent(descr($1),ref(___mdswteventdata))',event);
if nargout
 if rem(status,2)
  data = mdsdata('___mdswteventdata');
 else
  data = '';
 end
end
