Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.1 - 日本語

Change language to:
English - 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ヘルプ >> Elementary Functions > Integer representation > dec2bin

dec2bin

10進数から2進数への変換

呼び出し手順

str=dec2bin(x)

str=dec2bin(x,n)

引数

x

double行列, 正の整数値

n

正の整数

str

文字列の行列

説明

正の整数(または整数のベクトル/行列) xを指定すると, この関数は, xの2進数表現を含む 文字列(または文字列の列ベクトル)を返します. xの次元が1より大きい場合, 列ベクトルstrの各要素が xの要素の2進表現となります (すなわち,str(i)x(i)の2進表現).

strの要素の長さがn より小さい場合 (すなわち, length str(i) < n), str要素の左側に,長さが n.等しくなる分の文字 '0'を str要素の左側に追加します.

// 例 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)

参照

  • base2dec — bを基底とする表現から整数への変換
  • bin2dec — 2進表現を整数に変換
  • oct2dec — 8進数を10進数に変換
  • hex2dec — 16進数から10進数への変換
  • dec2oct — 10進数から8進数への変換
  • dec2hex — 10進数から16進数への変換
Report an issue
<< dec2base Integer representation dec2hex >>

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:
Thu Oct 02 13:58:21 CEST 2014