I want to give my participants the option of choosing which block to start with in the trial. I wrote this code: ButtonName = questdlg('Which block do you want to start with?', ... 'Block Type', 'B1','B2','B3','B4')and it returns the following error message, Warning: Default string does not match any button string name.
Please kindly advice. Thanks in advance.

 채택된 답변

Matt Fig
Matt Fig 2011년 6월 2일

1 개 추천

The proper use of QUESTDLG is:
ButtonName = questdlg(Question, Title, Btn1, Btn2, Btn3, DEFAULT)
Only (up to) three custom buttons may be specified, followed by the default button. So your code is read as having three buttons and a default named B4, which doesn't match any of the buttons. The last argument is always interpreted as the default button if there are 3 or more arguments.
If you need to have 4 buttons, you will have to make your own GUI, which shouldn't be very difficult...

댓글 수: 4

Walter Roberson
Walter Roberson 2011년 6월 2일
In 2008b it was still only 2 buttons.
Matt Fig
Matt Fig 2011년 6월 2일
@Walter: I am using 2007b, and this makes 3 buttons, with button 2 as the default:
ButtonName = questdlg('Question','Title','Bt1','Bt2','Bt3','Bt2')
Are you saying in 2008b, this only makes two buttons?
Walter Roberson
Walter Roberson 2011년 6월 2일
Ah, a disagreement between the help (2 buttons) and the doc (3 buttons)
Daelyn Greene
Daelyn Greene 2019년 4월 11일
Is there a way to not have the default button? Just a personal opinion, but the blue around one of the buttons looks bad (it doesn't match my color scheme in the rest of the document). Also, is it possible to change font and/or font color in the pop-up window?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

태그

질문:

2011년 6월 2일

댓글:

2019년 4월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by