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

Artem Lensky
Artem Lensky 2022년 5월 25일
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

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

David Willingham
David Willingham 2022년 5월 26일

0 개 추천

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

Michel du Montmorency
Michel du Montmorency 2022년 10월 20일
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 2022년 10월 20일

댓글을 달려면 로그인하십시오.

tshanduko
tshanduko 2025년 3월 21일

0 개 추천

After creating the following vector, t, which of the following syntaxes will result in an error? Select all that apply.
t = [10 15 20 25 30 35];
t([1 4:5 6])
t([1 6 4])
t([1 .5 4])
t(10) = 13
t(2:4)
t(2 3 4)
Submit

댓글 수: 1

Steven Lord
Steven Lord 2025년 3월 21일
This is not an answer to the original question about connecting MATLAB and Python. Please ask it as a separate question using the Ask link near the top of the page. When you do, show what you believe the answer to be and we can let you know if the answer is correct or not.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 5월 26일

댓글:

2025년 3월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by