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 次查看(过去 30 天)
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

回答(1 个)

Image Analyst
Image Analyst 2013-11-22
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

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by