定数の型
typeof(123)
倍精度浮動小数点で表現できる最大値
mtlb_realmax
最小値
mtlb_realmin
整数型
a=int16(123)
typeof(a)
b=int32(a)
typeof(b)
演算結果のデータ型
a=uint32(123)
b=uint32(345)
c=(a+b)*(b-a)
typeof(c)
オーバーフローすると他の数値に
uint8(300)
整数型に変換すると小数点以下は切り捨て
uint32(123.567)
数値の丸め
a=1.23
[ceil(a) floor(a) round(a) fix(a)]
b=-1.56
[ceil(b) floor(b) round(b) fix(b)]
数値表示のフォーマット
a=1.2345678
format('v',11)
a
format('e',15)
a
16進数への変換
dec2hex(255)
論理演算
a=[1 2 3]
b=[1 0 5]
a&b
a|b
function c=xor(a,b)
c=a&~b|~a&b
a==b
c=a>b
typeof(c)
d=bool2s(c)
typeof(d)
typeof(123)
倍精度浮動小数点で表現できる最大値
mtlb_realmax
最小値
mtlb_realmin
整数型
a=int16(123)
typeof(a)
b=int32(a)
typeof(b)
演算結果のデータ型
a=uint32(123)
b=uint32(345)
c=(a+b)*(b-a)
typeof(c)
オーバーフローすると他の数値に
uint8(300)
整数型に変換すると小数点以下は切り捨て
uint32(123.567)
数値の丸め
a=1.23
[ceil(a) floor(a) round(a) fix(a)]
b=-1.56
[ceil(b) floor(b) round(b) fix(b)]
数値表示のフォーマット
a=1.2345678
format('v',11)
a
format('e',15)
a
16進数への変換
dec2hex(255)
論理演算
a=[1 2 3]
b=[1 0 5]
a&b
a|b
function c=xor(a,b)
c=a&~b|~a&b
a==b
c=a>b
typeof(c)
d=bool2s(c)
typeof(d)