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

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 help >> Elementary Functions > Integer representation > dec2bin

dec2bin

2進表現

呼び出し手順

[str]=dec2bin(x[,n])

パラメータ

x

正の整数のスカラー/ベクトル/行列

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進数を整数に変換する
  • hex2dec — 16進数表現から整数への変換
  • dec2oct — 整数の8進表現
  • dec2hex — 整数の16進表現
<< bin2dec 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 May 12 11:45:48 CEST 2011