- Create a new app using MATLAB App Designer.
- Add a button and set a callback function for the same.
- Mention the following command if you want to run a python file from the GUI.
I need to run a .sh file through MATLAB GUI. Is there a way to do that?
3 次查看(过去 30 天)
显示 更早的评论
I need to run a python program through my MATLAB GUI. The GUI has a push button. Is there a way to do so?
0 个评论
回答(1 个)
Meet
2025-1-17
Hi Tushar,
You can run a python program through MATLAB App Designer, by peforming the following steps:
% 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!!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!