필터 지우기
필터 지우기

Does @(x) matlab function exist in C language ?

조회 수: 1 (최근 30일)
Pierre-Olivier Desrosiers
Pierre-Olivier Desrosiers 2022년 7월 5일
댓글: Steven Lord 2022년 7월 5일
Hey guys, I'm currently working on a standalone app and I have to write my s-function in C language. I also have the s-function written in Matlab and I use the @(x) function. Thus, I was wondering if this function exist in C language?

채택된 답변

dpb
dpb 2022년 7월 5일
편집: dpb 2022년 7월 5일
Standard C does not include what is generically called a "lambda" outside MATLAB.
GCC has an extension but I've never used it.
The generic thing is to write and include a named function in place of the anonymous function.
  댓글 수: 8
Pierre-Olivier Desrosiers
Pierre-Olivier Desrosiers 2022년 7월 5일
Thank you Steven. However, the work I have to do is to make a standalone app (with Simulink Compiler) of a simulink model using S-Function (written in C). Thus, if I already have my S-function written in Matlab language, can I just use Matlab Coder to generate this S-function in C language ? That'd save me a lot of time !
Steven Lord
Steven Lord 2022년 7월 5일
I haven't worked very much or at all with Simulink Compiler and S-functions but I believe the answer to your question is yes, assuming that all the MATLAB functions you're using in your S-function support C/C++ Code Generation and you're not violating any of the limitations for those functions in that mode.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by