Matlab Interactive Brokers Connection Response
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!