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!