MATLAB Answers

Matlab app designer can't go further than the first dropdown value

10 views (last 30 days)
farzad
farzad on 24 Mar 2020
Commented: Sean de Wolski on 16 Apr 2020
Hi All
I have made an app with a dropdown and a push button. I should choose a value from dropdown and based on that the pushbutton will run a certain code pasted under it. let's say the dropdown values are 1,2,3
the problem is :
the app works fine If I choose the first value on dropdown menu and use the
if app.ConfigDropDown.Value == '1'
elsif app.ConfigDropDown.Value == '2'
elsif app.ConfigDropDown.Value == '3'
end
only if I choose the 1 , the code could run. otherwise it will give this error :
Matrix dimensions must agree.
Error in app/ExecuteButtonPushed (line 40)
if app.ConfigDropDown.Value == '2'
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.

  0 Comments

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 24 Mar 2020
Edited: Sean de Wolski on 24 Mar 2020
if app.ConfigDropDown.Value == '1'
elseif app.ConfigDropDown.Value == '2'
elseif app.ConfigDropDown.Value == '3'
end
You're missing some e's.

  4 Comments

Show 1 older comment
Sean de Wolski
Sean de Wolski on 24 Mar 2020
Put a break point on that line (click the little - to the left of the line) then click the button. Stop and inspect the variables and see what isn't as expected.
farzad
farzad on 24 Mar 2020
I don't know if putting a break in the app designer would really help since I can't see the output in the command prompt.
I only know that the app works if only the first drop down value is chosen, it does not work if I change it to other values
Sean de Wolski
Sean de Wolski on 16 Apr 2020
You can see the value in the command prompt. Once you're stopped, type the value at the command prompt.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by