Clear Filters
Clear Filters

GUI: How do I turn off a push button when a text box is empty?..... Also, how can I produce error message when wrong file type is opened?

1 view (last 30 days)
Dear all,
I am making a GUI (I am a newbie to this) and I am stuck on two things:
1) I would like to prevent the user from selecting a file type other than .wav. I have managed to get the open dialog box to display only .wav files but that doesn't stop them selecting all files and opening another file type. This breaks the rest of my GUI. How can I defend against this?
Edit: I solved the other question I aksed. But i am still stuck on the question above^^
I would really appreciate some help.
Thank you very much
Best regards

Answers (1)

Image Analyst
Image Analyst on 22 Nov 2013
Don't make the user type in a filename - that's very user unfriendly. If I saw that I would consider the programmer a real amateur and be annoyed at how inconvenient he made my user experience. Asking them to browse with uigetfile() is only slightly better. In my opinion, it's best to use dir() to get a list of wav filenames and load them into a listbox. Then the user is guaranteed to click on a wave file because that's all that you loaded in. Here's a framework that will play wave files to get you started: http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component

Categories

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

Community Treasure Hunt

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

Start Hunting!