UIPUTFILE Documentation Innaccurate/Change Warning Dialog?

2 views (last 30 days)
The doc for returned file argument for uiputfile says in part...
  • If the user specifies an existing file name, then a warning dialog box opens stating that the file already exists and provides an option to replace the file.
  • If the user clicks Yes in the warning dialog box, then MATLAB replaces the existing file and returns the file name.
  • If the user clicks No in the warning dialog box, then control returns to the uiputfile dialog box, enabling the user to specify a different file name.
  • If the user cancels the dialog box, then MATLAB returns 0 to file.
This appears to be incorrect in that clicking Yes doesn't actually do anything to the existing file, but is the only way to retrieve the filename if the application wants to append further data to an existing file as if the user gets scared going to immediately trash the file from the warning message (the app can't control) and cancels, one is in a "can't get there from here" loop.
Is, in fact, the behavior described not, in fact true (don't see how it could be, really, the dialog doesn't actually open the file; it just returns the file name; the dialog just scares the user into thinking it will do so).
So, the secondary Q? is -- if one is actually going to append to an existing file, is there a way to change the popup warning message to tell the user not to fret; the file isn't going to be zapped, or should just forget about uiputfile and use uigetfile instead that has no such dialog as the easier coding route? Except uigetfile won't accept anything except an existing file so can't make a new one that way...
So, that's out; fixing the dialog warning somehow seems more needed than I thought as am left to just type into a text field manually without the benefit of the browswer window.

Answers (1)

Jan
Jan on 26 Oct 2022
I agree, that the text of the documentation is misleading.
"Select a file to append or choose a new file" does not match the purpose of uigetfile or uiputfile.
There are some FileExchange contribution, which expand these 2 standard functions:
I'm not sure, if one of them satisfies the need to choose or create a file. Maybe one of the methods can be adjusted accordingly.
Sorry, if you have checked this already. I'm aware that you do know the FEX also.
  3 Comments
dpb
dpb on 26 Oct 2022
Everything there is pretty heavyweight and use java components (and so do the TMW functions under the hood I see). I'm sure can make something work that way but am ignorant of Java and really didn't want to have to try to learn enough to patch up something for just bypassing the dumb/inaccurate/unchangeable warning dialog message.
In my mind, uiputfile is for the purpose; just it doesn't have the facility to not scare the user into not doing what needs doing...I'll see if I can just add some additional comfort words in a tooltip or somesuch, maybe; it didn't look to be a trivial thing to modify any of the FEX submissions in a few minutes.
Thanks for the feedback/links, anyways, even if I choose to go some other route.
dpb
dpb on 26 Oct 2022
Well, tooltips let me add the comforting words it won't delete the file when "APPEND" is checked, but I then discovered the backtrack that with AppDesigner components, the tooltip text is no longer HTML compatible -- one can embed the \n character, but that's basically the limit of customization at present.

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!