uigetfile Multiselect option not working for single file select
I have been trying to figure out why you can’t select a single file, if you have the ‘MultiSelect’ option set to ‘on’ in the uigetfile command. I need to be able to select ‘one or more’ files. Here is the code:
% Select and Open file
[files, pathname] = uigetfile({‘*.xls*’; ‘*.csv’}, …
‘Select One or More Files’, ‘MultiSelect’, ‘on’);
for filecount = 1:length(files)
filename = convertCharsToStrings(files(filecount));
opts = detectImportOptions(filename, VariableNamingRule="modify");
MDRdata = readtable(filename, opts);
time = datetime(MDRdata.ZuluDate_Time,"InputFormat",’yyyy-MM-dd”T”HH:mm:ss.SSS”Z’);
time.Format = ‘HH:mm:ss.SSS’;
….
I keep getting the following:
"Error using detectImportOptions
Unable to find or open ‘1’. Check the path and filename or file permissions.
Error in ApacheMDRProgram_04162024 (line 12)
opts = detectImportOptions(filename, VariableNamingRule="modify");"
It works fine if you select more than one file.I have been trying to figure out why you can’t select a single file, if you have the ‘MultiSelect’ option set to ‘on’ in the uigetfile command. I need to be able to select ‘one or more’ files. Here is the code:
% Select and Open file
[files, pathname] = uigetfile({‘*.xls*’; ‘*.csv’}, …
‘Select One or More Files’, ‘MultiSelect’, ‘on’);
for filecount = 1:length(files)
filename = convertCharsToStrings(files(filecount));
opts = detectImportOptions(filename, VariableNamingRule="modify");
MDRdata = readtable(filename, opts);
time = datetime(MDRdata.ZuluDate_Time,"InputFormat",’yyyy-MM-dd”T”HH:mm:ss.SSS”Z’);
time.Format = ‘HH:mm:ss.SSS’;
….
I keep getting the following:
"Error using detectImportOptions
Unable to find or open ‘1’. Check the path and filename or file permissions.
Error in ApacheMDRProgram_04162024 (line 12)
opts = detectImportOptions(filename, VariableNamingRule="modify");"
It works fine if you select more than one file. I have been trying to figure out why you can’t select a single file, if you have the ‘MultiSelect’ option set to ‘on’ in the uigetfile command. I need to be able to select ‘one or more’ files. Here is the code:
% Select and Open file
[files, pathname] = uigetfile({‘*.xls*’; ‘*.csv’}, …
‘Select One or More Files’, ‘MultiSelect’, ‘on’);
for filecount = 1:length(files)
filename = convertCharsToStrings(files(filecount));
opts = detectImportOptions(filename, VariableNamingRule="modify");
MDRdata = readtable(filename, opts);
time = datetime(MDRdata.ZuluDate_Time,"InputFormat",’yyyy-MM-dd”T”HH:mm:ss.SSS”Z’);
time.Format = ‘HH:mm:ss.SSS’;
….
I keep getting the following:
"Error using detectImportOptions
Unable to find or open ‘1’. Check the path and filename or file permissions.
Error in ApacheMDRProgram_04162024 (line 12)
opts = detectImportOptions(filename, VariableNamingRule="modify");"
It works fine if you select more than one file. transferred MATLAB Answers — New Questions