Too many output arguments - appdesigner

조회 수: 2 (최근 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
  댓글 수: 1
URDEA
URDEA 2023년 1월 19일
but " Too many output arguments " error still appears...

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

카테고리

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