How can I generate c++ code of a matlab function using embedded coder from simulink?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I would like to use embedded coder for this function from the 5G toolbox:
function harqProcesses = hNewHARQProcesses(numHARQProcesses,rvsequence,ncw)
harqProcess.RVSequence = rvsequence; % Sharing one rvsequence per CW
harqProcess.ncw = ncw; % Set number of codewords
harqProcess.blkerr = zeros(1,ncw); % Initialize block errors
harqProcess.RVIdx = ones(1,ncw); % Add RVIdx to process
harqProcess.RV = rvsequence(ones(1,ncw));
% Create HARQ processes as indicated by numHARQProcesses
harqProcesses = repmat(harqProcess,numHARQProcesses,1);
end
댓글 수: 0
답변 (2개)
AnnQ
2021년 6월 18일
Hello,
You can try adding a MATLAB Function block in your model which supports C/C++ code generation from Embedded Coder: https://www.mathworks.com/help/simulink/ug/what-is-a-matlab-function-block.html?searchHighlight=matlab%20function%20block&s_tid=srchtitle
Here is a simple example you can try to get started: https://www.mathworks.com/help/simulink/ug/creating-an-example-model-that-uses-a-matlab-function-block.html
댓글 수: 0
Janani Janagarajan Kalaivani
2021년 6월 18일
Hi,
There are two possible workflows.
- Directly generate C++ code from the Matlab script using Matlab
- Use Matlab Function Block in Simulink and then generate C++ code using Simulink Coder
Since you have Embedded Coder, you have access to both Matlab Coder & Simulink Coder. Hence to assist you further, let me know your intended workflow.
Examples for Matlab Coder
Examples for Simulink Coder
https://www.mathworks.com/help/simulink/slref/matlabfunction.html
Also, the below link gives you the list of functions compatible for Code Generation.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!