Too many output arguments - appdesigner

I have some problems...
A little context: in my project I need a menu bar named "syntax" and two sub-menus (one with treeplot(p) syntax and one with treeplot(p,nodeSpec, edgeSpec) syntax) and a button named " result" which, when I click, will build a tree graph taking into account the syntax selected from the menu bar and also the other properties.
My problem is that, when I select the type of syntax from the sub-menu, it directly draws the graph, which is not good, because the drawing of the graph must be done after pressing the button named "result". in the code below, I tried to assign to the "wave" variable: 1 if the first sub-menu is selected or 2 if the second sub-menu is selected and put it in the code of the function of the button named "result".
% Menu selected function: SintaxeMenu
function SintaxeMenuSelected(app, event)
if(app.treeplotpMenuSelected.Text) %here i get "Too many output arguments" error
app.val=1;
else
if(app.treeplotpnodeSpecedgeSpecMenuSelected.Text) %here i get "Too many output arguments" error too
app.val=2
end
end
I assigned 1 or 2 to the variable "wave" to be able to specify somehow in the function of the button called "result" that "if the submenu with the syntax treeplot(p) is selected, then do these conditions" thing
function RezultatButtonPushed(app, event)
app.p=str2num(app.pEditField.Value)
if (app.val==1)
treeplot(app.p)
else
if(app.val==2)
treeplot(app.p,app.nodeSpecDropDown.Value,app.edgeSpecDropDown.Value)
end
end

Answers (1)

It looks like you are trying to figure out if treeplotpMenuSelected is selected. You need to check it's Value property.
function SintaxeMenuSelected(app, event)
if(app.treeplotpMenuSelected.Value == 1)
app.val=1;
else
if(app.treeplotpnodeSpecedgeSpecMenuSelected.Value == 1)
app.val=2
end
end

1 Comment

but " Too many output arguments " error still appears...

Sign in to comment.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Release

R2022b

Asked:

on 19 Jan 2023

Commented:

on 19 Jan 2023

Community Treasure Hunt

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

Start Hunting!