필터 지우기
필터 지우기

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