bca12f6d2cdc4a0d6b8742f0477be61b79f00918
[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" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="bin2dec" xml:lang="en">
18     <refnamediv>
19         <refname>bin2dec</refname>
20         <refpurpose>convert from binary to decimal</refpurpose>
21     </refnamediv>
22     <refsynopsisdiv>
23         <title>Syntax</title>
24         <synopsis>y=bin2dec(str)</synopsis>
25     </refsynopsisdiv>
26     <refsection>
27         <title>Arguments</title>
28         <variablelist>
29             <varlistentry>
30                 <term>str</term>
31                 <listitem>
32                     <para>a matrix of strings containing only
33                         characters '1' and '0'
34                     </para>
35                 </listitem>
36             </varlistentry>
37             <varlistentry>
38                 <term>y</term>
39                 <listitem>
40                     <para>a matrix of doubles, positive integer values</para>
41                 </listitem>
42             </varlistentry>
43         </variablelist>
44     </refsection>
45     <refsection>
46         <title>Description</title>
47         <para>
48             Given <literal>str</literal> a binary string, this function returns
49             <literal>y</literal> the decimal number whose the binary representation is
50             given by <literal>str</literal> ( <literal>y</literal> and
51             <literal>str</literal> have the same size).
52         </para>
53     </refsection>
54     <refsection>
55         <title>Examples</title>
56         <programlisting role="example"><![CDATA[
57 // example 1 :
58 // '1010110' : is the binary representation of 86
59 str='1010110';
60 y=bin2dec(str)
61
62 // example 2 :
63 // '1011011' : is the binary representation of 91
64 // '1010010' : is the binary representation of 82
65 str=['1011011'; '1010010']
66 y=bin2dec(str)
67  ]]></programlisting>
68     </refsection>
69     <refsection role="see also">
70         <title>See also</title>
71         <simplelist type="inline">
72             <member>
73                 <link linkend="base2dec">base2dec</link>
74             </member>
75             <member>
76                 <link linkend="oct2dec">oct2dec</link>
77             </member>
78             <member>
79                 <link linkend="hex2dec">hex2dec</link>
80             </member>
81             <member>
82                 <link linkend="dec2bin">dec2bin</link>
83             </member>
84             <member>
85                 <link linkend="dec2oct">dec2oct</link>
86             </member>
87             <member>
88                 <link linkend="dec2hex">dec2hex</link>
89             </member>
90         </simplelist>
91     </refsection>
92 </refentry>