Hauptinhalt

oct2dec

R2026b

Convert octal to decimal numbers

Description

dec = oct2dec(oct) converts octal numbers in matrix oct to the decimal numbers in matrix dec, element by element. The rightmost digit is the least significant in both octal and decimal representations.

example

Examples

collapse all

Convert a 2-by-2 octal matrix to its decimal equivalent.

d = oct2dec([12 144;0 25])
d = 2×2

    10   100
     0    21

The octal number 144 is equivalent to 100 because 144=1(82)+4(81)+4(80)=100.

Input Arguments

collapse all

Octal numbers, specified as a row vector, a column vector, or a matrix.

Data Types: double

Output Arguments

collapse all

Decimal numbers, returned a row vector, a column vector, or a matrix depending on the input value and size of the input matrix.

Data Types: double

Extended Capabilities

expand all

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

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced before R2006a