主要内容

Extract MSB

R2026b

Extract most significant bit (MSB) of input

Since R2026b

  • Extract MSB block with one input and one output port.

Libraries:
Fixed-Point Designer HDL Support / Logic and Bit Operations

Description

The Extract MSB block allows you to extract the most significant bit (MSB) from the stored integer value of the input signal. For a signed input, the Extract MSB block returns the sign bit. If the input is a built-in integer or fixed-point data type, the output is returned as a ufix1 type. Floating-point inputs are passed through the block unchanged.

Examples

expand all

This example shows how to extract the most significant bit (MSB) from the stored integer value of an input signal.

Open and simulate the model.

open_system('ex_extract_msb_block');

Ports

Input

expand all

Input signal, specified as a scalar, vector, matrix, or N-D array. Floating-point inputs are passed through the block unchanged.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point
Complex Number Support: Yes

Output

expand all

Extracted most significant bit, returned as a scalar, vector, matrix, or N-D array. For a signed input, the Extract MSB block returns the sign bit. If the input u is a built-in integer or fixed-point data type, the output y is returned as a ufix1 type. Floating-point inputs are passed through the block unchanged.

See Fixed-Point Numbers in Simulink for an explanation of fixed-point data type and scaling notation in Simulink®.

Data Types: single | double | fixed point
Complex Number Support: Yes

Extended Capabilities

expand all

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

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2026b

See Also

Blocks

Functions