Matlab-Python: How to push user input from MATLab gui into python graphical interface?

8 views (last 30 days)
So I have a GUI in matlab with fields that relate to fields in Python interface program. What I want to do is let the user input information in the fields and with the press of a button it would push the data to the relevant data in python's interface. This would prevent the user having to input the info again. Are there any ways to go about this such as techniques, commands, etc..?
(btw I am totally new to this stuff esp. Python so sorry if I don't understand the technical diction)

Answers (1)

Ashwini Venkatappa
Ashwini Venkatappa on 9 Feb 2017
Edited: Ashwini Venkatappa on 9 Feb 2017
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:
>> pyversion
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.
For more information refer to the link below Getting started with python
Follow the link below for an example Call user defined python module
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.

Community Treasure Hunt

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

Start Hunting!