Uigetfile multiple selection in MATLAB app designer

조회 수: 11 (최근 30일)
Claudia Scarpellini
Claudia Scarpellini 2021년 11월 16일
댓글: Claudia Scarpellini 2021년 11월 16일
I'd like to have a button on matlab app designer that when pushed, enables the user to select more files.
I tried first with one single file with this code and everything works well:
[filename,path] = uigetfile('*.txt');
If then, I try to select more files with the following code:
[filename,path] = uigetfile('*.txt','Select the files','MultiSelect', 'on');
I get this error:
Index exceeds the number of array elements. Index must not exceed 0.
Error in matlab.ui.internal.dialog.FileChooser/updateFromDialog (line 215)
obj.PathName = filepaths{1};
Error in matlab.ui.internal.dialog.FileChooser/prepareDialog/localupdate (line 95)
updateFromDialog(obj,updateDataObject(obj));
Can anyone help me with this?
Thanks
  댓글 수: 2
Jan
Jan 2021년 11월 16일
I do not think that this is the problem here, but redefining the important Matlab function "path" by a variable is a bad idea. This can cause strange side effects during debugging.
Did you modify one of Matlab's toolbox functions? This is only possible if you work with admin privileges. Or did you insert a function in Matlab's path, which shadows builtin functions? This could happen if you add user defined folders on top of the path. Prefer to append your folders on the bottom.
You could use thus tool to identify sahdowing functions: https://www.mathworks.com/matlabcentral/fileexchange/27861-uniquefuncnames
Claudia Scarpellini
Claudia Scarpellini 2021년 11월 16일
Thank you for your answer. I'm not modyfying any toolbox function.
Could it have something to do with the fact that I'm using MATLAB online?
I modified my code to:
[filenameS, pathS] = uigetfile('*.txt','Select the files','MultiSelect', 'on');
But I still get the same error.

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 11월 16일
"Could it have something to do with the fact that I'm using MATLAB online?"
Yes. Multiselect with uigetfile is not currently possible in MATLAB Online.
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2021년 11월 16일
I believe the only way to find that out is to submit a bug report. At least that's what I did.
Claudia Scarpellini
Claudia Scarpellini 2021년 11월 16일
Thank you!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by