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

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?

 採用された回答

Angelo Yeo
Angelo Yeo 2024 年 4 月 25 日
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.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

リリース

R2024a

質問済み:

2024 年 4 月 25 日

回答済み:

2024 年 4 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by