Connecting Matlab and Python

11 vues (au cours des 30 derniers jours)
Or Shem Tov
Or Shem Tov le 26 Mai 2020
Hi guys,
I have a program in MATLAB that performs a few tasks.
In the process of solving the problem at hand I had to make a python script that does something and then the data needs to be returned back to MATLAB for machine learning.
I have all the code working fine but I need to run code in MATLAB, then save a CSV file, run a Python script and save in CSV again only to return to MATLAB for getting results.
So all in all I have 2 MATLAB scripts and 1 Python script that I need to combine.
I know that there's ways I could combine the two programs, what's the best way to do it?
If I am able to run this python script in MATLAB, how will I have access to the variables I have there? (for example: my python script returns a pandas dataframe which I save as a csv then run a MATLAB program on)
  1 commentaire
Artem Lensky
Artem Lensky le 25 Mai 2022
Check this submission that shows a few examples of how to exchange data using Pandas between matlab and pyhton https://au.mathworks.com/matlabcentral/fileexchange/111770-pandastomatlab

Connectez-vous pour commenter.

Réponse acceptée

Sai Sri Pathuri
Sai Sri Pathuri le 29 Mai 2020

Plus de réponses (1)

David Willingham
David Willingham le 26 Mai 2022
Hi,
We have some great resources on our GitHub page for calling Python from MATLAB
This repo shows how you can use a live task to copy and past python code directly into a live MATLAB script:
  2 commentaires
Michel du Montmorency
Michel du Montmorency le 20 Oct 2022
Hi David.
The resources you call "great" look like "greatly involved and complex". In a word: isn't "speech recognition" a little bit overshot to understand the basics of MATLAB-python interaction?
Anything easier?
David Willingham
David Willingham le 20 Oct 2022

Connectez-vous pour commenter.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by