<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<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="dec2bin" xml:lang="ja">
    <refnamediv>
        <refname>dec2bin</refname>
        <refpurpose>10進数から2進数への変換</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>呼び出し手順</title>
        <synopsis>
            str = dec2bin(x)
            str = dec2bin(x,n)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>引数</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>double行列, 正の整数値</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>n</term>
                <listitem>
                    <para>正の整数</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>str</term>
                <listitem>
                    <para>文字列の行列</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>説明</title>
        <para>
            正の整数(または整数のベクトル/行列)
            <literal>x</literal>を指定すると,
            この関数は,
            <literal>x</literal>の2進数表現を含む
            文字列(または文字列の列ベクトル)を返します.
            <literal>x</literal>の次元が1より大きい場合,
            列ベクトル<literal>str</literal>の各要素が
            <literal>x</literal>の要素の2進表現となります
            (すなわち,<literal>str(i)</literal>が
            <literal>x(i)</literal>の2進表現).
        </para>
        <para>
            <literal>str</literal>の要素の長さが<literal>n</literal>
            より小さい場合 (すなわち, length str(i) &lt; n),
            <literal>str</literal>要素の左側に,長さが
            <literal>n.</literal>等しくなる分の文字 '0'を
            <literal>str</literal>要素の左側に追加します.
        </para>
    </refsection>
    <refsection>
        <title>例</title>
        <programlisting role="example"><![CDATA[
// 例 1 :
x=86;
str=dec2bin(x)

// 例 2 :
// 86 の2進表現は : '1010110'
// 長さは7 (n以下)のため, str(の左側)に'0'が8個追加されます
x=86;n=15;
str=dec2bin(x,n)

// 例 3 :
x=[12;45;135]
z=dec2bin(x)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>参照</title>
        <simplelist type="inline">
            <member>
                <link linkend="bitstring">bitstring</link>
            </member>
            <member>
                <link linkend="dec2base">dec2base</link>
            </member>
            <member>
                <link linkend="dec2oct">dec2oct</link>
            </member>
            <member>
                <link linkend="dec2hex">dec2hex</link>
            </member>
            <member>
                <link linkend="bin2dec">bin2dec</link>
            </member>
        </simplelist>
    </refsection>
</refentry>