global eventdata orderid; eventdata = {}; orderid = 1; f = figure; set(f,'Visible','off');

% parameters (dont change, location-irrelevant, object-you can replace with
% [] but it will have a blank figure in the background, name of the event
% handler-optional parameter- alternatively call ib.registerevent('IBevent');)
tws = actxcontrol('TWS.TwsCtrl.1',[0 0 0 0],f,'twsevent');
tws.connect('', 7496, 1); 

newcontract
% parameters (orderid must be different every time, contract is a complex
% object generated by 'newcontract' above, '', 1 for a snapshot or 0 for a
% subscription- ib.cancelMktData(orderid) will stop the subscription
tws.reqMktDataEx(orderid, contract, '', 1)