How can you define a data structure to represent a PDU

I need to set up a protocol data unit for the MAC layer. Some fields in the PDU will be static while others vary randomly. An array of PDUs will be fed to OFDM transmitter.

Answers (1)

Are you intending that the resulting data structure be used with a particular Matlab function? If so then you will need to match the data structure used by that function.
If the OFDM transmitter is written by you, then you have design flexibility. One question you will need to answer along the way is whether the fields that could be random will always be random or whether you want your data structure to be able to represent a variable mix of constants and random values.
If you want your data structure to represent a variable mix of constants and random values, then I suggest that you use a structure in which each structure is represented by a constant, and each variable field is represented by a function handle. ishandle() will allow you to distinguish which you have; invoke the function handle to return the result.
Note that the arrangements will need to be more complicated if you need some of the fields to be expressions involving the "current" value of the random fields. For example, if you had a length field that was random, and then you had a payload field that was to contain data of size equal to the temporary random length, then you will need a more complex representation.

Categories

Asked:

on 20 Jan 2011

Community Treasure Hunt

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

Start Hunting!