필터 지우기
필터 지우기

How can I convert double to const real_T of a sfunction?

조회 수: 4 (최근 30일)
Alexander Nass
Alexander Nass 2018년 2월 7일
답변: Benjamin Thompson 2022년 10월 10일
Hi everyone :) ,
I am working on my Masters and have a C-code which I have to put into a sfunction for SIMULINK. As an in between result I have a value of an variable of datatype double (fx_u). With it other values have to be calculated also, which will be output of the sfunction in SIMULINK as well.
For that I have to convert the double to real_T, haven´t I? (real_T as output data type of a sfunction) How can I do that?
Code is something like:
for(i = 0; i <= limit; i++)
{
fx_u[i] = x0 + x1*u + x2*(u*u) + x3*(u*u*u) + x4*(u*u*u*u) + x5*(u*u*u*u*u);
u = u+res;
}
x = &fx_u; // <<--- I MEAN THIS LINE BECAUSE I GET A WARNING WHICH IS:
"warning: assignment from incompatible pointer type x = &fx_u;"
x is of data type real_T and fx_u is of data type double. x should be the output and fx_u is meant for further calculations.
In advance I thank you for your help. :)
Please don´t beat me, I am still a student.
  댓글 수: 1
fus
fus 2022년 4월 26일
Did you ever find a solution for this? Running into the same problem and google is not being my friend

댓글을 달려면 로그인하십시오.

답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 10월 10일
If x is a constant you cannot change it. You would need to supply a more complete example, it is hard to tell what you are trying to do.

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by