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.