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

8 次查看(过去 30 天)
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)

回答(1 个)

Ashwini Venkatappa
编辑:Ashwini Venkatappa 2017-2-9
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.

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by