I am trying to create a text file (using a gui), and I would like the name of the file to match what the user inputs in an edit text box. At first, I am trying to use a simple script (attached below) to see if I can accomplish this, but I am unable to create the .txt file. The file being created is just a "file". What would be the best way to approach this? Am I on the right track?
Thank you in advance for any help provided.
prompt = 'Please enter the file name: ';
fileName = input(prompt,'s');
fid = fopen(fileName, 'wt');
if fid == -1
error('Cannot open file: %s', fileName);