Info
This question is closed. Reopen it to edit or answer.
error using global parameter, to save value of parameter
1 view (last 30 days)
Show older comments
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
1 Comment
Walter Roberson
on 31 May 2015
Merged into existing question http://uk.mathworks.com/matlabcentral/answers/219737-error-using-global-to-save-value-of-parameter
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!