Info

此问题已关闭。 请重新打开它进行编辑或回答。

error using global parameter, to save value of parameter

1 次查看(过去 30 天)
hi,
how can i resolve this error; Global declaration not resolved to a Data Store Memory block registered via the Ports and Data Manager.
my code is:
function [y1, y2] = fcn(u)
%#codegen
coder.extrinsic('degtorad');
coder.extrinsic('radtodeg');
coder.varsize('Az','El','In','Or');
global k
Az=0;
El=0;
In=0;
Or=0;
n=0;
%k=0;
y1=0;
y2=0;
Azk =degtorad( u(1));
Elk= degtorad(u(2));
Ink=degtorad(u(3));
Ork=degtorad(u(4));
Az = [Az ; Azk];
El= [El ; Elk];
In=[In; Ink];
Or=[Or; Ork];
n=size(Az,1);
if (n==1)
k=1;
end
X2=cos(El(n))*cos(Az(n));
X3=sin(Az(n))*cos(El(n));
I=cos(In(k))*sin(El(n))-sin(In(n))*X2*cos(Or(k))-sin(In(k))*X3*sin(Or(k));
if (0.9<I && I<=1)
y1=radtodeg(In(k));
y2=radtodeg(Or(k));
else
if (n>1)
k=n-1;
I=cos(In(k))*sin(El(n))-sin(In(n))*X2*cos(Or(k))-sin(In(k))*X3*sin(Or(k));
y1=radtodeg(In(k));
y2=radtodeg(Or(k));
end
end

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by