Clear Filters
Clear Filters

Errors occurs while converting the code created using 5G Toolbox's SIB1 Recovery Example to C code using Matlab Coder.

2 views (last 30 days)
I am trying to convert the code created using the SIB1 Recovery Example of 5G toolbox into C code through Matlab coder.
However, many errors occurred and were corrected, but the two errors below have not yet been corrected.
First,
rxGrid = nrOFDMDemodulate(rxWaveform_1, nrb, scsCommon, nSlot,'SampleRate',Fs,'CarrierFrequency',fPhaseComp);
Error Message : In code generation, when you specify the 'SampleRate' name-value argument in the nrOFDMDemodulate(WAVEFORM,NRB,SCS,INITIALNSLOT,NAME,VALUE) syntax, the 'SampleRate' and 'Nfft' name-value arguments and the NRB and SCS arguments must be compile-time constants.
If the above syntax is changed as follows, incorrect operation will occur.
rxGrid = nrOFDMDemodulate(rxWaveform_1, nrb, scsCommon, nSlot);
Second,
[sib1bits,sib1CRC] = decodeDLSCH(cw,pdsch.Modulation,pdsch.NumLayers,dci.RedundancyVersion);
Error Message : When generating code, the NLAYERS input must be a constant value.
Can you resolve errors that occur in Matlab Coder?

Accepted Answer

Angelo Yeo
Angelo Yeo on 25 Apr 2024
1) This must be a question on compile-time constant of MATLAB Coder. For basic understanding, see coder.Constant Class.
2) For nrOFDMDemodulate, see the "Extended Capabilities" for your information. This function requires some name-value arguments to be compile-time constant for code generation. (It's a MUST!) And this requires you to use -args value of codegen function. Below is a screenshot from the nrOFDMDemodulate doc.
3) For nrDLSCHDecoder, same story applies. See its "Extended Capabilities" section and read usage notes for "nlayers" input. This should be used with -args when using codegen.

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!