The aforementioned error indicates that the Trading Toolbox in MATLAB cannot establish a connection to the IB Trader Workstation ActiveX-based API. This can result when the installation of the IB Trader Workstation did not include the ActiveX APIs, the input port number does not match the one use by TWS, or if the user is running an incompatible version of MATLAB or Trader Workstation. Also, The Interactive Brokers functionality in Trading Toolbox require a licensed account for IB Trader Workstation. As of MATLAB R2014a, both 32-Bit and 64-Bit MATLAB work with the IB Trader Workstation.
If the user meets the requirements, the APIs can be installed directly. The latest version of the IB Trader Workstation APIs can be found at the following location, after accepting the terms of agreement:
To verify that the port numbers match, you can navigate to 'File > Global Configuration > API' on the main window of TWS. When you select 'API > Settings', you will see the Socket port number. When calling 'ibtws', the input port (second input) must be identical to the number you see in the Settings.
If this does not resolve the issue, verify whether you can use the COM interface outside MATLAB, i.e. in a Visual Basic Script containing:
Dim ibtws As Object
Set ibtws = CreateObject("TWS.TwsCtrl")
If the output of this command is not "success", there is something broken with the IB Trader API installation and you should contact IB support.