Too many output arguments - appdesigner
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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 Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!