Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.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ヘルプ >> Strings > length

length

オブジェクトの長さ

呼び出し手順

n=length(M)

引数

M

行列 (通常または多項式または文字列) または リスト

n

整数または整数行列

説明

通常または多項式の行列の場合, nMの行の数に列の数を乗じた整数になります. (Mが論理値行列の場合にも有効)

文字列からなる行列の場合 (および部分的に文字列の場合) lengthは, 文字列の行列Mのエントリの長さを nに返します.

リストの長さはリストの中の要素の長さです (sizeでも出力されます).

The length of an array M of cells or of structures is the number of elements of the array. It is equivalent to size(M, "*").

mlistのlengthはデフォルトでmlistの要素数ですが, オーバーロードすることができます(例参照). 文字列でないハイパー行列は, 関数をオーバーロードする必要がないことに注意してください. さもなくば,lengthは ハイパー行列の次元の積を返します.

length('123')3となります. length([1,2;3,4])4となります.

警告 : 疎行列のlengthは, 行列の最大次元を返し,次元の積ではありません. (例えば: length(sparse(eye(12,2)))は, 24)ではなくmax(12,2) を返します. 疎行列の場合は size(...,'*')を使用してください.

length([123 ; 456 ])
length(['hello world',SCI])
length(rand(2,2,2))
a = mlist(["myMlistT" "field1" "field2"],"aexample","bexampleb");
length(a)
// lengthがmlistにオーバーロードされたいない場合のデフォルトの動作は3を返す
// mlist型myMlistTのオーバーロード関数を作成
function r=%myMlistT_length(M)
    r = length(M.field1)
endfunction
length(a)
// length(a.field1)の結果8を返す

参照

  • size — オブジェクトの大きさ

履歴

バージョン記述
5.4.0 この関数によりmlist型のオーバーロードが可能となりました.
6.0.0
  • The length() of any array C of cells was formerly always 3, whatever are the number of dimensions and the sizes of the array. It is now the number of elements of the array at null depth (without recursive counting), equal to size(C, "*").
  • The length() of any array S of structures was formerly equal to its number of fields +2, whatever are the number of dimensions and the sizes of the array. It is now the number of elements of the array at null depth, equal to size(S, "*").
Report an issue
<< justify Strings part >>

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:
Mon Jan 03 14:37:53 CET 2022