whats wrong with my app?
古いコメントを表示
I have declared app2 as the input argument in my startup for visualiseringsapp2_1 because it is using the public property from app2 (called antall_soner), and the callingapp is app 3 . ( meaning the visualiseringsapp2_1 is called from app3), as you can see.
I am gettin this error message when I run the app:
Error using visualiseringsapp2_1/startupFcn (line 23)
Not enough input arguments.
Error in visualiseringsapp2_1 (line 115)
runStartupFcn(app, @(app)startupFcn(app, varargin{:}))
Error in app3/DisplayallresultsButtonPushed (line 1855)
visualiseringsapp2_1(app)
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
Dot indexing is not supported for variables of this type.
Error in visualiseringsapp2_1/SwitchValueChanged (line 42)
for i = 1:app.Callingapp.antall_soner
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 378)
Error while evaluating Switch PrivateValueChangedFcn.
16 件のコメント
Kojiro Saito
2024 年 3 月 3 日
How do you call visualiseringsapp2_1.mlapp?
function startupFcn(app, app2, app3) requires two additional input arguments (app2 and app3).
Muazma Ali
2024 年 3 月 3 日
Kojiro Saito
2024 年 3 月 3 日
It's because "Not enough input arguments" occurs in the startupFcn of visualiseringsapp2_1, which means there is an issue in calling the visualiseringsapp2_1 from other apps.
I think app3/DisplayallresultsButtonPushed (line 1855) is the root cause.
How about changing from
visualiseringsapp2_1(app)
to
visualiseringsapp2_1(antall_soner, app)
in DisplayallresultsButtonPushed callback in app3?
antall_soner is app2 and app is app3 in this context.
Muazma Ali
2024 年 3 月 3 日
Muazma Ali
2024 年 3 月 3 日
Muazma Ali
2024 年 3 月 3 日
Kojiro Saito
2024 年 3 月 3 日
"No appropriate method, property, or field 'antall_soner' for class 'visualiseringsapp2_1'." means there is no difinition of antall_soner in visualiseringsapp2_1.mlapp.
Could you confirm app.antall_soner exists in the Public Property in visualiseringsapp2_1.mlapp?
Muazma Ali
2024 年 3 月 4 日
Kojiro Saito
2024 年 3 月 5 日
I'm a bit confused.
in app3, you are calling the following function.
visualiseringsapp2_1(app.Callingapp.antall_soner,app)
in this context, visualiseringsapp2_1 is app1, app is app3, but app.Callingapp is as app3 in app2, so how do you define app.Callingapp inside app3?
Muazma Ali
2024 年 3 月 13 日
Muazma Ali
2024 年 3 月 13 日
Muazma Ali
2024 年 3 月 13 日
Kojiro Saito
2024 年 3 月 13 日
I am not sure why in app3, the startup would be.
function startupFcn(app, app2)
app.Callingapp = app2;
end
Did you mean app3 is calling visuaiseringsapp2_1? I am not clear why app2 is an input argument of app3.
Muazma Ali
2024 年 3 月 13 日
Kojiro Saito
2024 年 3 月 13 日
@Muazma Ali I understand you want to execute app2 Push Button -> app3, then, app3 Push Button -> visualiserignsapp2_1. Is it correct?
Muazma Ali
2024 年 3 月 14 日
編集済み: Muazma Ali
2024 年 3 月 14 日
回答 (1 件)
Kojiro Saito
2024 年 3 月 14 日
I think the following will work.
app2.mlapp
Set public properties.
properties (Access = public)
antall_soner
end
and button callback is the following.
function App2ButtonPushed(app, event)
app3(app)
end
app3.mlapp
Set private properties.
properties (Access = private)
Callingapp
end
and starup function is as follows.
function startupFcn(app, app2)
app.Callingapp = app2;
end
and Button Push Callback will be.
function App3ButtonPushed(app, event)
visualiseringsapp2_1(app.Callingapp, app)
end
visualiseringsapp2_1.mlapp
Set public properties.
properties (Access = public)
Callingapp
app2
end
and starup function is as follows.
function startupFcn(app, app2, app3)
app.Callingapp = app3;
app.app2 = app2;
app.antall_soner = app2.antall_soner;
end
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!