- 'xlsread' isn't recommended for web apps. Use 'readtable' or 'readmatrix' instead.
uigetfile in Matlab Web App Server R2021a is not working
7 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Chetan
2023 年 11 月 10 日
編集済み: Chetan
2023 年 11 月 10 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で MATLAB Web App Server についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!