MATLAB: Do I receive an error in the Datafeed Toolbox if I subscribe to a security in the Bloomberg FETCH function using the Real Time option

bloombergcallbackDatafeed Toolboxfetchm-file

If I subscribe to a security in the Bloomberg FETCH function with the 'realtime' option I receive the following error:
Warning: Error occurred while evaluating listener callback.
??? Error using ==> winfun\private\comeventcallback
Error firing event 'Data' to 'GetSwapDataFromBBG_'.

Best Answer

The callback function registered while using the Real Time option in the FETCH function, must be a standalone MATLAB file and not a subfunction.
This is because the listener runs in the base MATLAB workspace and will not be able to locate the subfunction, as a result, the above error is generated.
Hence you may use a separate function MATLAB file located on the MATLAB path to resolve this issue.