How can I replace ksdensity for c++ generation with the Matlab Coder ?

조회 수: 10 (최근 30일)
Jeanne
Jeanne 2014년 6월 16일
댓글: DN 2014년 10월 5일
Hello everyone,
I am working on a c++ project and someone gave me a Matlab code so I try to use the Matlab Coder. The problem is that the ksdensity function is not supported, so I would like to know if I can replace this function with something else...

채택된 답변

Kaustubha Govind
Kaustubha Govind 2014년 6월 16일
I don't know of a MATLAB function equivalent that is supported for code-generation, but if you are able to find a C implementation of the function, you can use the following construct in your MATLAB code to have the generated code call into the C-library:
if coder.target('MATLAB')
% Executing in MATLAB, call function ksdensity
[f,xi] = ksdensity(x);
else
% Executing in the generated code.
% Call the C function as per the signature.
coder.ceval('c_ksdensity', coder.ref(x), coder.ref(f), coder.ref(xi));
end

추가 답변 (1개)

DN
DN 2014년 9월 10일
Hi Jean,
How did you get on with this? It's still not supported, right? but have you managed to get a C version of this code to do what Kaustubha recommended?
best dian
  댓글 수: 2
Jeanne
Jeanne 2014년 9월 12일
Hi Dian,
I wrote my own C version and used it with Kaustubha's code. There is a similar function in the MLPack library, but I couldn't make it work with Windows 7 (64).
DN
DN 2014년 10월 5일
Hi Jeanne,
I see, I don't know MLPack but it looks like a C++ library, right? Can you perhaps let me know what file to look for and where in the MLPack website can I find it? Apologies for asking you the name/path. Furthermore I wouldn't know where to start but I gather it (MLPack file) guided you allot to write your C version?
best wishes dian

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by