Matlab dialog box -


please me:

i want user enter file name containing numbers or/and letters (without space).

so have 2 problems:

1) tried next code, dialog box opened , opened , opened.... because don't know how edit 'answer' input without call 'inputdlg' again.

2) checking validity of file name: used 'isempty' , 'strfind' functions, know there easier option this. in code, have check each letter in other case:

    while isempty(strfind(answer,'=')) == 0 || isempty(strfind(answer,'*')) == 0 || ... 

maybe 'regexp' function, don't know how :/

so code is:

prompt={'enter file name:'}; name='input file name'; numlines=1; answer=inputdlg(prompt,name,numlines); while isempty(strfind(answer,'=')) == 0     answer=inputdlg(prompt,name,numlines); end 

as @bdecaf suggested in comments, use uiputfile function display "save as" type of dialog:

[fname,pname] = uiputfile({'*.xlsx' 'excel (*.xlsx)'}, 'save as', 'myfile.xlsx'); if pname==0, error('no file selected'); end fullname = fullfile(pname,fname); 

screenshot

which returns like:

>> fname fname = test.xlsx  >> fullname fullname = c:\users\amro\documents\example\test.xlsx 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -