MATLAB: What command prompts for file name then creates/opends file createfilenameopenprompt What syntax would I use to make a script that would prompt the user to choose a file name then create/open that file? Thank You Best Answer Look at uigetfile[filename, pathname, filterindex] = uigetfile( ... {'*.mat','MAT-files (*.mat)'; ... '*.mdl','Models (*.mdl)'; ... '*.*', 'All Files (*.*)'}, ... 'Pick a file', ... 'MultiSelect', 'on');and uiputfile.If you don't want an UI option, you can also use input() with the 's' option to input a string and then use fread(), fwrite(), etc. to read and write the file. Related SolutionsMATLAB: File Names inside a folder(x) and subfolders of(x) Here you go:Path = 'C:\Users\' % wherever you want to searchsearchPath = [Path ,'\**\*.csv']; % Search in folder and subfolders for *.csvFiles = dir(searchPath); % Find all .csv files% Save to text filefid = fopen('C:\Users\FoundFiles.txt','wt'); % create fileformatSpec= '%s\n' % new Line after Stringfor i = 1:size(Files,1) % write each string in for-loop fprintf(fid,formatSpec, Files(i).name);endfclose(fid); % close file againGreetings Stefan MATLAB: App Designer: Use Tree to Browse Directory see the help of uigetfile:"Enabling multiple file selection in the dialog: [filename, pathname, filterindex] = uigetfile( ... {'*.mat','MAT-files (*.mat)'; ... '*.mdl','Models (*.mdl)'; ... '*.*', 'All Files (*.*)'}, ... 'Pick a file', ... 'MultiSelect', 'on');" Related QuestionSaving file with file name from userIs it possible to let MATLAB choose a file in a path if the user enters the first letters belonging to the fileHelp with GUI – Push buttonHow to read and display first frame of 90 Dicom images and select one from the displayed frames for further processing
Best Answer