MATLAB: How to Read a file with unknown name csvreaddlmreadmatrix Hi I get one .csv file in a directory and I cannot control the name of it. Therefore, I want to read it without knowing its name. How can I do it ? Best Answer Hello,You can do so like this (assuming only one csv file):A = dir('*.csv');B = csvread(A.name);Hope this helps! Related SolutionsMATLAB: Fullfile to contain multiply file extension Try:filePatternCSV = fullfile(handles.sourceFolder, '*.csv'); csvFiles = dir(filePatternCSV); filePatternXLS = fullfile(handles.sourceFolder, '*.xls'); xlsFiles = dir(filePatternXLS);filePatternODS = fullfile(handles.sourceFolder, '*.ods'); odsFiles = dir(filePatternODS);allFiles= vertcat(csvFiles,xlsFiles,odsFiles); MATLAB: Changing folder’s name from unknown name d = dir;The above command returns a struct array which has a field called datenum. Each file in the current directory corresponds to an entry in the array. The latest file will have the largest datenum Related QuestionImport csv files with sequential namesHow to import multiple .CSV files in MATLAB with no sequential filenameRenaming Imported Variable with Initally Unknown Name
Best Answer