I need to run a .sh file through MATLAB GUI. Is there a way to do that?

조회 수: 3 (최근 30일)
TUSHAR TYAGI
TUSHAR TYAGI 2019년 10월 28일
답변: Meet 2025년 1월 17일
I need to run a python program through my MATLAB GUI. The GUI has a push button. Is there a way to do so?

답변 (1개)

Meet
Meet 2025년 1월 17일
Hi Tushar,
You can run a python program through MATLAB App Designer, by peforming the following steps:
  1. Create a new app using MATLAB App Designer.
  2. Add a button and set a callback function for the same.
  3. Mention the following command if you want to run a python file from the GUI.
% Mention the python executable path
pythonPath = 'C:\Users\mp\AppData\Local\Programs\Python\Python311\python.exe';
% Path to your Python file
scriptPath = 'C:\Users\mp\Downloads\test.py';
% Command to execute the Python script
command = [pythonPath, ' ', scriptPath];
% Execute the command
[status, cmdout] = system(command);
I hope this helps!!

카테고리

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