- 'xlsread' isn't recommended for web apps. Use 'readtable' or 'readmatrix' instead.
uigetfile in Matlab Web App Server R2021a is not working
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello Matlab Community,
We developed a web app where the user uploads an Excel file, imports the data and calculations are being dispayed. This used to work fine for the last couple of month. We used uigetfile and xlsread in a separate m.file.
We are now compiling with version 2021a and the WebAppServer running on 2021a.
After executing the uigetfile the Web App is stuck within the m.file with our xlsreach commands.
Code in the App Designer:
function UploadExcelsheetButtonPushed(app, event)
app.UploadExcelsheetButton.Enable = 'off';
[file, path, ~] = uigetfile('*.xlsx');
app.filename = [path file];
Location = app.filename;
run("Test.m")
app.OperationTimeEditField.Value = Inputs.Operation_time;
drawnow;
app.UploadExcelsheetButton.Enable = 'on';
end
Code in Test.m:
Inputs.Operation_time = xlsread(Location,'B1:B1');
EDIT: I have tried to do it with readtable and get the same error
Note: Interestingly it works when the file is in .csv format. Same code for xlsx files will not work.
Can you please tell us what u think went wrong? It used to work before.
Thank you and BR,
Christian
0 commentaires
Réponses (1)
Chetan
le 10 Nov 2023
Modifié(e) : Chetan
le 10 Nov 2023
I understand that you developed a MATLAB web app where users can upload Excel files for data calculations. However, the app gets stuck with 'uigetfile' in the .m file
Here are some of the possible workaround to fix this issue:
Here's your modified code:
Inputs.Operation_time = readmatrix(Location,'Range','B1:B1');
Adjust the 'Range' argument as needed.
Refer to the following MathWorks Documentation regarding the usage of the function:
Hope this Helps !
0 commentaires
Voir également
Catégories
En savoir plus sur MATLAB Web App Server dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!