MATLAB Examples

Optional Output Formats

This example shows how to pass optional inputs to certain functions to change the output format provided from the function.

Create a new parameter structure, enb.

enb.NCellID = 0;
enb.CellRefP = 1;
enb.NSubframe = 0;
enb.NDLRB = 9;
enb.Ng = 'Sixth';

For example, consider the case where a list of indices for a certain physical channel is generated using ltePCFICHIndices.

The input argument, enb, is a structure with the appropriate fields. By default, these indices are one-based, as opposed to the zero-based indices specified in the technical specification (TS) documentation.

ind = ltePCFICHIndices(enb);
firstIndex = ind(1)
firstIndex =

  uint32

   2

Change the base number used in the index generation by providing an additional optional input argument. Specify '0based' to generate zero-based indices or '1based' to generate one-based indices.

ind = ltePCFICHIndices(enb, '0based');
firstIndex_0based = ind(1)
ind = ltePCFICHIndices(enb, '1based');
firstIndex_1based = ind(1)
firstIndex_0based =

  uint32

   1


firstIndex_1based =

  uint32

   2

The first index generated when no optional argument is provided matches the first index when '1based' is specified. The optional input is not required. If you do not specify an optional input, the function uses the default value.

Specify multiple output format options for a function by providing a cell array input argument, opts.

opts = {'sub', '1based', 'reg'};
pcfichInd = ltePCFICHIndices(enb, opts)
pcfichInd =

  4x3 uint32 matrix

    1    1    1
   25    1    1
   55    1    1
   79    1    1

The generated PCFICH indices are in subscript indexing style, one-based, and refer to resource element groups. The cell array of options that you specify indicates the format for the returned indices.

Varying the order of the opts cell entries produces the same result.

opts = {'1based', 'sub', 'reg'};
pcfichInd = ltePCFICHIndices(enb, opts)
pcfichInd =

  4x3 uint32 matrix

    1    1    1
   25    1    1
   55    1    1
   79    1    1

The order in which you provide the opts inputs is not relevant. Both cases produce the same values in the output argument, pcfichInd.