Matlab Interactive Brokers Connection Response

3 vues (au cours des 30 derniers jours)
Jack Frusty
Jack Frusty le 10 Fév 2016
Here's what I'm trying to achieve
Main Function
# Connect to Interactive Brokers TWS
# Verify that connection has been established
# If connection established, draw gui
end Main Function
Here's a basic code I have for this in Matlab
function main
ib = ibtws('', 7496); %Connect
while ~exist('ibBultInErrMsg', 'var') %Check for response
pause(0.1)
end
drawGUI(); %If you've made it this far, then draw the gui
end
Here's the problem: the variable ibBuiltInErrMsg is only created once the main function is done running. (Matlab automatically creates this variable, and puts it in the same 'workspace' as the variable ib) I am trying to check within the Main Function if the variable ibBuiltInErrMsg does in fact exist. I am doing this as a form of connection verification since the object ib is constructed by Matlab in such a way that it does not provide a 'confirmation' flag for connection.
Essentially from my understanding is that Matlab does not block execution of the main thread to receive 'asynchronous' responses from external software.
Is there a workaround or will I have to use a more powerful language?
Thanks.

Réponses (0)

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by