MATLAB Answers

Uigetfile Does Not Open A File In Standalone Application R2020a

10 views (last 30 days)
Kris Hoffman
Kris Hoffman on 29 May 2020
Answered: Kris Hoffman on 31 May 2020
I'm using the following line to load a file into my application.
[app.name,~ ] = uigetfile({'*.mp4;*.m4v;*.mov'},'Pick a video file','MultiSelect','off');
I've also tried
[app.name,app.path ] = uigetfile({'*.mp4;*.m4v;*.mov'},'Pick a video file','MultiSelect','off');
On OSX (High Sierra)
1.) I compiled the application on R2020a and included the MCR with the compiled application.
2.) The entire application output folder structure is then put onto an external HDD
3.) The entire folder structure is put into the "Documents" folder on another OSX (High Sierra) computer with no Matlab on it.
4.) The MCR is installed on the Matlab-less computer.
5.) The application is run after the MCR is installed.
6.) I click a browse button on the application which includes the above code.
7.) I choose a file to open (any size file). Dialog box closes.
8.) Nothing happens. (Activity monitor shows 25% CPU utilization for a few seconds then nothing)
I'm trying to be explicitly clear as to how to reproduce the problem. I've looked through the documentation included when the app is compiled and countless forums online, and I still cannot find an answer. I've "created a log file", but like many others, I cannot find it.
  1 Comment
dpb
dpb on 30 May 2020
uigetfile never actually loads a file; it only returns the file name and optionally the path the user selected from the dialog opened.
It's the application's job then to use the appropriate function to actually open the data file.
You've coded the first part, now must take the next steps...

Sign in to comment.

Accepted Answer

Kris Hoffman
Kris Hoffman on 31 May 2020
I figured it out. Of course right after I posted this question haha.
True, yes, uigetfile does nothing but get the file name and or path to the file(s). I did have a load command later on in the script
load(app.name)
However, I took for granted that the files always loaded in the IDE because it was always in the correct directory (where the videos were). All I needed to add was...
cd(app.path)
right after the uigetfile and everything was fine.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!