bitstring() complement
[scilab.git] / scilab / modules / elementary_functions / help / en_US / integer_representation / bin2dec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * Copyright (C) 2011 - DIGITEO - Michael Baudin
6  *
7  * Copyright (C) 2012 - 2016 - Scilab Enterprises
8  *
9  * This file is hereby licensed under the terms of the GNU GPL v2.0,
10  * pursuant to article 5.3.4 of the CeCILL v.2.1.
11  * This file was originally licensed under the terms of the CeCILL v2.1,
12  * and continues to be available under such terms.
13  * For more information, see the COPYING file which you should have received
14  * along with this program.
15  *
16  -->
17 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
18           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
19           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
20           xmlns:scilab="http://www.scilab.org" xml:id="bin2dec" xml:lang="en">
21     <refnamediv>
22         <refname>bin2dec</refname>
23         <refpurpose>convert from binary to decimal</refpurpose>
24     </refnamediv>
25     <refsynopsisdiv>
26         <title>Syntax</title>
27         <synopsis>y=bin2dec(str)</synopsis>
28     </refsynopsisdiv>
29     <refsection>
30         <title>Arguments</title>
31         <variablelist>
32             <varlistentry>
33                 <term>str</term>
34                 <listitem>
35                     <para>a matrix of strings containing only
36                         characters '1' and '0'
37                     </para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>y</term>
42                 <listitem>
43                     <para>a matrix of doubles, positive integer values</para>
44                 </listitem>
45             </varlistentry>
46         </variablelist>
47     </refsection>
48     <refsection>
49         <title>Description</title>
50         <para>
51             Given <literal>str</literal> a binary string, this function returns
52             <literal>y</literal> the decimal number whose the binary representation is
53             given by <literal>str</literal> ( <literal>y</literal> and
54             <literal>str</literal> have the same size).
55         </para>
56     </refsection>
57     <refsection>
58         <title>Examples</title>
59         <programlisting role="example"><![CDATA[
60 // example 1 :
61 // '1010110' : is the binary representation of 86
62 str='1010110';
63 y=bin2dec(str)
64
65 // example 2 :
66 // '1011011' : is the binary representation of 91
67 // '1010010' : is the binary representation of 82
68 str=['1011011'; '1010010']
69 y=bin2dec(str)
70  ]]></programlisting>
71     </refsection>
72     <refsection role="see also">
73         <title>See also</title>
74         <simplelist type="inline">
75             <member>
76                 <link linkend="base2dec">base2dec</link>
77             </member>
78             <member>
79                 <link linkend="oct2dec">oct2dec</link>
80             </member>
81             <member>
82                 <link linkend="hex2dec">hex2dec</link>
83             </member>
84             <member>
85                 <link linkend="dec2bin">dec2bin</link>
86             </member>
87             <member>
88                 <link linkend="bitstring">bitstring</link>
89             </member>
90         </simplelist>
91     </refsection>
92 </refentry>