Too many output arguments - appdesigner

1 次查看(过去 30 天)
URDEA
URDEA 2023-1-19
评论: URDEA 2023-1-19
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

回答(1 个)

Hans Scharler
Hans Scharler 2023-1-19
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

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by