Hello, I am having an issue getting an error to show using MATLAB to connect to FT232H Adafruit Breakout via Python. I wanted to throw an error when the FT232H is not plugged in using a message box in Matlab. However, this was the only example code that I could find online. Is this the proper way of doing this? It seems like it's not catching the error properly when it is not plugged in.
try py.list(['x','y',1]) catch e e.message
%While there is a Python exception, adafruit_flag = 0.
while(isa(e,'matlab.exception.PyException')) handles.adafruit_flag = 0; e.ExceptionObject button = questdlg('Error. Adafruit is not connected. If you want to reconnect, reconnect and press yes. Else press no to exit and close down Bode','Yes', 'No'); switch button case 'Yes' break; case 'No' %shutoff device
end end
Best Answer