Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
type
変数の型を返す
呼び出し手順
i = type(x)
パラメータ
- x
Scilab オブジェクト
- i
整数
説明
type(x)
は,以下のように
x
の型の種類を整数で返します :
1 : 実数または複素数の定数行列.
2 : 多項式行列.
4 : 論理値行列.
5 : 疎行列.
6 : 論理値疎行列.
7 : Matlab 疎行列.
8 : 1 2 4 または 8 バイトに保存される整数行列.
9 : グラフィックハンドルの行列.
10 : 文字列の行列.
13 : コンパイル済みの関数 (Scilab コード).
14 : 関数ライブラリ.
15 : リスト.
16 : 型付リスト (tlist).
17 : 行列の型付リスト (mlist).
128 : Xcosブロックへのポインタ(参照)、lufact()の結果へのポインタな.
129 : 添字に使用される暗黙の大きさの多項式.
130 : Scilab 内部コード (C または Fortran コード).
0 :
An undefined element of a list (with a typeof void
, such as
in the function call foo(a,,b)
, or in
list(%pi,,%i,,,%z)
), or a null object of typeof
listdelete
returned by null()
.
Remarks
Some data may be stored in custom containers defined as typed lists of type 16
(tlist) or 17 (matrix-oriented typed mlist). This is also the case for embedded
types like (rationals), structures
(struct),
state-space, interactive trees
(uitree), etc, for which
type(..)
will return 16 or 17. One will use
typeof to get more information about their actual
(sub)type.
Type conversion in mixed operations:
When a binary operator (like the multiplication) or an n-ary iterated one (like the concatenation) is applied beween two operands of distinct but compatible types, usually the type of one of both is implicitely converted, and the other operand sets the type of the result to its own type.
Examples with the concatenation :
[%t, 3.124]
, [int8(5), 3.124]
, etc.
For the concatenation, addition, substraction, multiplication, division, and the power operation, the hierarchy between operands types is as follows (read "A < B": B imposes its type to A) :
- boolean < (decimal number, complex encoded number)
- (decimal number, complex-encoded number) < encoded integer.
- polynomial (real | complex) < rational (real | complex)
Examples
// (Select some lines, right-click and choose "Execute.." to run the selection) L = list(%pi,,"abc"); type(L(2)) // undefined component of a list type(42) // decimal numbers type(%nan) type(%inf) type(1+%i) // complex numbers s = sparse([1,2;4,5;3,10],[1,2,3]); type(s) // sparse-encoded decimal or complex numbers type(%t) // booleans type(s>2) // sparse-encoded booleans g = int8([1 -120 127 312]); // encoded integers type(g) type(1.23 * int8(4)) type(1-%z+%z^2) // polynomials type(gdf()) // graphic handles type("foo") // texts deff('[x] = mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']); type(mymacro) // Scilab functions type(disp) // Built-in functions l = list(1,["a" "b"]); // simple lists type(l) e = tlist(["listtype","field1","field2"], [], []); type(e) // Typed list h = mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); type(h) // Typed matrix-oriented list clear s, s.r = %pi // structures type(s) c = {%t %pi %i %z "abc" s} // cells type(c) r = [%z/(1-%z) (1-%z)/%z^2] type(r) // rational fractions
参照
- typeof — explicit type or overloading code of an object
- inttype — 整数データ型で使用される整数型
- isreal — 変数が実数または複素数のエントリかどうかを調べるc
- brackets — Concatenation. Recipients of an assignment. Results of a function
- overloading — 表示,関数および演算子オーバーロード機能
- poly — Polynomial definition from given roots or coefficients, or characteristic to a square matrix.
- rational — Scilab オブジェクト, Scilabの有理数
- tlist — Scilab オブジェクトおよび型付のリスト定義.
- mlist — Scilab オブジェクト, 型付リスト定義に向いた行列.
- null — deletes a list component or a field of a structure, Mlist, or Tlist
履歴
バージョン | 記述 |
6.0 | The type 11 is removed. It was used for uncompiled Scilab functions. |
Report an issue | ||
<< strings | types | typename >> |