フィルターのクリア

How to use bus signal from simulink as struct in the matlab function block using coder.ceval?

1 回表示 (過去 30 日間)
I want to use my external C code in matlab function block of simulink and I got an error message stated below.
Passing incompatible type for argument 1 of external C function 'AC_Guidance' with coder.ceval. Function 'AC Control law/MATLAB Function1' (#157.182.189), line 9, column 30
How can I resolve this problem? Here is my C code.
void MVUS_Guidance(struct Waypoint wpt_cur, struct Waypoint wpt_pas, struct UAV_States states, double* Velocity, double* Altitude, double* Heading, double* Path_error)
{
double LLA_cur[3];
double LLA_pass[3];
double LLA_ac[3];
LLA_cur[0] = wpt_cur.Latitude;
LLA_cur[1] = wpt_cur.Longitude;
LLA_cur[2] = wpt_cur.Altitude;
LLA_pass[0] = wpt_pas.Latitude;
LLA_pass[1] = wpt_pas.Longitude;
LLA_pass[2] = wpt_pas.Altitude;
LLA_ac[0] = states.GPS_Lat;
LLA_ac[1] = states.GPS_Lon;
LLA_ac[2] = states.GPS_Alt;
...
}
and here is my code in the matlab function block.
function [Velocity, Altitude, Heading, Path_error] = MVUS_Guidance(WPT_cur, WPT_pas, States)
Velocity = 0;
Altitude = 0;
Heading = 0;
Path_error = 0;
coder.ceval('MVUS_Guidance', WPT_cur, WPT_pas, States, coder.ref(Velocity), coder.ref(Altitude), coder.ref(Heading), coder.ref(Path_error));
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by