In the call back function of the ui button of MATLAB GUI call the python function.
1. To call Python libraries from MATLAB, you need to install a supported version of the reference implementation (CPython) for Python. MATLAB supports versions 2.7 and 3.3. In order to check if Python is installed, execute the following command on your MATLAB command window:
If all the fields of the result are empty, it indicates that either Python is not installed or the correct version of Python is not installed.
2. Check the bitness of Python version installed on your machine and the bitness of MATLAB session running on your machine. It is necessary to ensure that if you are working on a 64-bit (32-bit) installation of MATLAB, you have installed a 64-bit (32-bit) version of Python.
Note: Verify that "foo.py" Python script is present on Python's path. It is required for the Python script to be on Python's path to invoke the functions/ methods from this script.
Check for possible errors in "foo.py" by using it in Python. If the script does not work in Python, it will lead to errors when used from MATLAB.