`uigetfile` Not Working in MATLAB Online App, but Works Fine in Desktop Version
9 views (last 30 days)
Show older comments
Hello,
I’m encountering an issue with uigetfile in a MATLAB App that I developed. The app works perfectly when installed and run on the desktop version of MATLAB (R2024a), but when I try to run the same app on MATLAB Online, uigetfile doesn’t seem to work as expected.
Here’s what I’m doing:
- In the app, I use uigetfile to open a file selection dialog, and based on the user’s selection, I display the file’s contents in a text area.
- On MATLAB Desktop, the dialog opens fine, and I can read the file successfully.
- However, when I run the app in MATLAB Online, no file is selected even after interacting with the dialog.
% Button pushed function: UploadButton
function UploadButtonPushed(app, event)
% Open file upload dialog
[file,path] = uigetfile('*.*');
% If the user presses "Cancel" or no file is selected
if isequal(file, 0) || isequal(path, 0)
app.TextArea.Value = 'No file selected or operation canceled.';
app.FilenameLabel.Text = 'No file selected';
else
% Construct the full file path
fullPath = fullfile(path, file);
% Display the full path in the filename label
app.FilenameLabel.Text = fullPath;
end
end
What I’ve Tried:
- I tested the same code on MATLAB Desktop, and it works perfectly.
- On MATLAB Online, the dialog either fails to open, or no file is selected, and the app responds as if the user pressed “Cancel.”
Questions:
- Is there a known issue or limitation with uigetfile in MATLAB Online?
- Should I be using a different method for file selection in MATLAB Online apps?
Any guidance or workaround would be greatly appreciated! Thank you.
0 Comments
Answers (1)
Rahul
on 21 Oct 2024
Hi Praful,
In case you are trying to implement a MATLAB application which consists of selecting local files using “uigetfile” function, this soecific issue seems to be corrected in the later releases as I was able to reproduce the same only on MATLAB Online R2024a.
You can try upgrading your MATLAB Online release to R2024b or latest version, since the provided application executes and displays selected file names correctly on this release.
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!