How can I generate c++ code of a matlab function using embedded coder from simulink?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Federico Di Alessio
am 2 Jun. 2021
Beantwortet: Janani Janagarajan Kalaivani
am 18 Jun. 2021
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 Kommentare
Antworten (2)
AnnQ
am 18 Jun. 2021
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 Kommentare
Janani Janagarajan Kalaivani
am 18 Jun. 2021
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 Kommentare
Siehe auch
Kategorien
Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!