MATLAB: Am I getting an error during function call to lteDMRSIndices, when I an trying to modify an example in lteDMRS function to display DMRS for R.50 reference channel

LTE Toolbox

I want to generate DMRS for R.50 reference channel using the lteDMRS function. When I try to modify the example in the link mentioned below:
https://www.mathworks.com/help/lte/ref/ltedmrs.html?s_tid=doc_ta#bu6vzbj
I am getting the following error:
Error using mwltelibrary
The MEX Library function call (lteDMRSIndices) resulted in an error: For the
parameter field PRBSet, MATLAB array should be numeric and cannot be of cell
type
Error in lteDMRSIndices (line 105)
ind = mwltelibrary(['lteDMRSIndices' varargin]);

Best Answer

The lteDMRSIndices function expect the resource block set allocation to be a vector, not a cell array.
For "R.50", this parameter is set to a cell array, as the resource allocation is dynamic (it changes depending on the subframe number).
The way to use the lteDMRSIndices function is then to input the setting for each subframe, one at a time:
(note the for subframeNr loop added in the code below)
enb = lteRMCDL('R.50');
enb.PDSCH.TxScheme = 'Port7-14';
enb.PDSCH.NLayers = 4;
ntxants = 8;
enb.PDSCH.W = lteCSICodebook(enb.PDSCH.NLayers,ntxants,[0 0]).';
cfg = enb;
for subframeNr = 0:9
cfg.NSubframe = subframeNr;
cfg.PDSCH.PRBSet = enb.PDSCH.PRBSet{subframeNr+1};
subframe = zeros(lteResourceGridSize(cfg,ntxants));
cfg.PDSCH.NTxAnts = size(cfg.PDSCH.W,2);
dmrsInd = lteDMRSIndices(cfg,cfg.PDSCH);
dmrs = lteDMRS(cfg,cfg.PDSCH);
subframe(dmrsInd) = dmrs;
end
Related Question