Functions from .mlx don't work in .mlapp
Show older comments
I'm trying to make an app from my .mlx file.
In .mlx I have the following snippet of code:
a = 50;
b = 60;
aP = [];
bP = [];
[aP,bP] = dosomething(a,b);
function [raP,rbP] = dosomething(x,y)
i = 0:pi/3:2*pi-pi/3;
Za = 0*i;
Xa = cos(i)*x;
Ya = sin(i)*x;
raP= [Xa;Ya;Za];
j = 0:pi/3:2*pi-pi/3;
Zb = 0*j;
Xb = cos(j)*y;
Yb = sin(j)*y;
rbP = [Xb;Yb;Zb];
end
However, when I try to use it in .mlapp as such:
properties (Access = private)
a
b
aP
bP
end
methods (Access = private)
function [raP,rbP] = dosomething(x,y)
i = 0:pi/3:2*pi-pi/3;
Za = 0*i;
Xa = cos(i)*x;
Ya = sin(i)*x;
raP= [Xa;Ya;Za];
j = 0:pi/3:2*pi-pi/3;
Zb = 0*j;
Xb = cos(j)*y;
Yb = sin(j)*y;
rbP = [Xb;Yb;Zb];
end
function startupFcn(app)
app.a = 50;
app.b = 60;
app.aP = [];
app.bP = [];
[app.aP,app.bP] = dosomething(app.a, app.b);
end
end
I get the following error:
Undefined function 'dosomething' for input arguments of type 'double'.
Incorrect number or types of inputs or outputs for function 'dosomething'.
Error in test/startupFcn (line 45)
[app.aP,app.bP] = dosomething(app.a,app.b);
Error in matlab.apps.AppBase/runStartupFcn (line 68)
ams.runStartupFcn(app, startfcn);
Error in test (line 79)
runStartupFcn(app, @startupFcn)
In the .mlx the a and b variables are also doubles so what's the fuss?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Parallel Server in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!