Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Elementary Functions > Radix conversions > bin2dec

bin2dec

convert from binary to decimal

Syntax

y=bin2dec(str)

Arguments

str

a matrix of strings containing only characters '1' and '0'

y

a matrix of doubles, positive integer values

Description

Given str a binary string, this function returns y the decimal number whose the binary representation is given by str ( y and str have the same size).

Examples

// example 1 :
// '1010110' : is the binary representation of 86
str='1010110';
y=bin2dec(str)

// example 2 :
// '1011011' : is the binary representation of 91
// '1010010' : is the binary representation of 82
str=['1011011'; '1010010']
y=bin2dec(str)

See also

  • base2dec — convert from base b to decimal
  • oct2dec — convert from octal to decimal
  • hex2dec — convert from hexadecimal to decimal
  • dec2bin — convert from decimal to binary
  • bitstring — A string giving the literal bit representation of a number
Report an issue
<< base2dec Radix conversions dec2base >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:49:19 CET 2020