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

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 manual >> 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)
<< 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:
Wed Jan 26 16:25:03 CET 2011