please help me:
I want the user to enter a file name containing numbers or/and letters (without a space).
so I have two problems:
1) I tried the next code, but the dialog box is opened and opened and opened…. because I don’t know how to edit the ‘answer’ input without to call the ‘inputdlg’ again.
2) checking the validity of the file name: I used the ‘isempty’ and ‘strfind’ functions, but I know there is an easier option to do this. In my code, I have to check each letter in other case:
while isempty(strfind(answer,'=')) == 0 || isempty(strfind(answer,'*')) == 0 || ...
maybe with ‘regexp’ function, but I don’t know how to do this :/
so my code is:
prompt={'Enter the File name:'};
name='Input for file name';
numlines=1;
answer=inputdlg(prompt,name,numlines);
while isempty(strfind(answer,'=')) == 0
answer=inputdlg(prompt,name,numlines);
end
As @bdecaf suggested in the comments, you could use UIPUTFILE function to display a “save as” type of dialog:
which returns something like: