Main Content

Insert Zero

(Removed) Distribute input elements in output vector

Insert Zero has been removed. Use MATLAB® code in a MATLAB Function (Simulink) block instead. For more information, see Version History.

Library

Sequence Operations

  • Insert Zero block

Description

The Insert Zero block constructs an output vector by inserting zeros among the elements of the input vector. The input signal can be real or complex. Both the input signal and the Insert zero vector parameter are column vector signals. The number of 1s in the Insert zero vector parameter must be evenly divisible by the input data length. If the input vector length is greater than the number of 1s in the Insert zero vector parameter, then the block repeats the insertion pattern until it has placed all input elements in the output vector.

The block determines where to place the zeros by using the Insert zero vector parameter.

  • For each 1 the block places the next element of the input vector in the output vector

  • For each 0 the block places a 0 in the output vector

The block accepts the following data types: int8, uint8, int16, uint16, int32, uint32, boolean, single, double, and fixed-point. The output signal inherits its data type from the input signal.

To implement punctured coding using the Puncture and Insert Zero blocks, use the same vector for the Insert zero vector parameter in this block and for the Puncture vector parameter in the Puncture block.

Parameters

Insert zero vector

A binary vector with a pattern of 0s and 1s that indicate where the block places either 0s or input vector elements in the output vector.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a

expand all

R2023a: Removed

  • Insert Zero has been removed. Use MATLAB code in a MATLAB Function (Simulink) block instead.

  • This code can be used in a MATLAB Function (Simulink) block to insert zeros into a data stream.

    function y = fcn(u,insertZeroVector)
        numSeg = length(u)/sum(insertZeroVector);
        c = zeros(length(insertZeroVector), numSeg,'like',u);
        c(logical(insertZeroVector),:) = reshape(u,[],numSeg);
        y = c(:);
    end
    
    As with Insert Zero, the input length must be an integer multiple of the number of ones in the Insert zero vector parameter.

  • For an example using this code, see Insert Zeros into Random Number Stream.