integrate pyton script in a standalone Matlab app

10 views (last 30 days)
i'm trying to develop a standalone matlab app but with some python script in it. when i run the code in app designer, it works fine but when i compile the standalone app, it doesn't work. when packaging I include the python script and the python folder (oct_converter) which it's necessary and also the init.py and the package looks fine I guess. I also commented the lines where I called python and develop another standalone app and it worked so I think it's definitely the use of python script. also since it's the standalone app, it doesn't show me any erorr message it just crashes
I'm running matlab R2020b on macOS
  6 Comments
Giancarlo Meccariello
Giancarlo Meccariello on 19 Jul 2021
@frederic tchuisseu Yes the startup program of the app designer. That runs everytime you launch the app, therefore you make sure that python is always found.
@Eric Delgado I downloaded Anaconda on my computer and installed it for "all users". With the command
pe = pyenv
the python version is found, and it works only if Anaconda was installed for all users.
I didn't include any separate python scripts as you did but I used some python functions instead.
When you export your standalone programm, make sure the end user has installed Anaconda aswell for "all users" on their computer. With the startup programm searching for the actual python version should everthing work as desired.
Let me know if this helped you.
James Nesson
James Nesson on 1 Apr 2022
Edited: James Nesson on 1 Apr 2022
i have this in the startup call back and it runs with no alert.
%check if python is installed
pe = pyenv;
if isempty(pe.Version)
fig = uifigure;
uialert(fig,'Please install Python and XlsxWriter',['Python' ...
' is not installed']);
end
but when my code gets to my pyrunfile command it does not work.

Sign in to comment.

Answers (0)

Categories

Find more on Python Package Integration in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!