This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

comm.WalshCode System object

Package: comm

Generate Walsh code from orthogonal set of codes


The WalshCode object generates a Walsh code from an orthogonal set of codes.

To generate a Walsh code:

  1. Define and set up your Walsh code object. See Construction.

  2. Call step to encode the input signal according to the properties of comm.WalshCode. The behavior of step is specific to each object in the toolbox.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj) and y = obj() perform equivalent operations.


H = comm.WalshCode creates a Walsh code generator System object, H. This object generates a Walsh code from a set of orthogonal codes.

H = comm.WalshCode(Name,Value) creates a Walsh code generator object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).



Length of generated code

Specify the length of the generated code as a numeric, integer scalar value that is a power of two. The default is 64.


Index of code of interest

Specify the index of the desired code from the available set of codes as a numeric, integer scalar value in the range [0, 1, ... , N-1]. N is the value of the Length property. The default is 60. The number of zero crossings in the generated code equals the value of the specified index.


Number of output samples per frame

Specify the number of Walsh code samples that the step method outputs as a numeric, positive, integer scalar value . The default is 1. If you set this property to a value of M, then the step method outputs M samples of a Walsh code of length N. N is the length of the code that you specify in the Length property.


Data type of output

Specify the output data type as double | int8. The default is double.


cloneCreate Walsh code generator object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset states of Walsh code generator object
stepGenerate Walsh code from orthogonal set of codes


expand all

Generate 16 samples of a length-64 Walsh code sequence.

walsh = comm.WalshCode('SamplesPerFrame',16)
seq = walsh()
walsh = 

  comm.WalshCode with properties:

             Length: 64
              Index: 60
    SamplesPerFrame: 16
     OutputDataType: 'double'

seq =



This object implements the algorithm, inputs, and outputs described on the Walsh Code Generator block reference page. The object properties correspond to the block parameters, except:

  • The object does not have a property to select frame based outputs.

  • The object does not have a property that corresponds to the Sample time parameter.

Introduced in R2012a

Was this topic helpful?