Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: English - Français - Português - Русский
Scilabヘルプ >> Files : Input/Output functions > listvarinfile

listvarinfile

呼び出し手順

```listvarinfile(filename);
[names, typs, dims, vols] = listvarinfile(filename)```

引数

filename

nams

dims

リスト, ファイルに保存した変数の次元

typs

vols

説明

このユーティリティ関数は, saveにより作成されたScilabデータファイルに含まれる 変数の一覧 "a la whos" を取得します.

 有理数および状態空間はプレーンな tlist として報告されます.

例

```// Preparing some data of various types:
b = rand(2,3) < 0.5;                    // booleans
i = uint64(grand(3,4,2,"uin",0,100));   // hypermatrix of encoded integers
c = grand(3,3,"uin",-10,10); c=c+c'*%i; // complex numbers
p = (1-%z).^(0:3);                      // polynomials
r = p/(1+%z);                           // rationals
sp = sprand(10,15,0.1);                 // sparse numbers
spb = sp<0.5;                           // sparse booleans
t = ["This" "software" ; "is" "Scilab"];// Texts
g = [gdf() gda()];                      // Graphics
function Test()                         // macro
disp("listvarinfile() test for macros")
end
M = linspace;                           // macro
L = list(%f, int8(-23),, %i-%z, list("abc",%e)); // simple list
C = {"abc" %t ; %z list(1/%z, 4)};      // array of cells
S(4,2).r = %pi;                         // array of structures
vars = list("b","i","c","p","r","sp","spb","t","g","Test","M","L","C","S");

// Archiving data in a binary file:
File = TMPDIR + "\listvarinfile.sod";
save(File, vars(:))

// Listing the file content:
[names,types,dims,vols] = listvarinfile(File);
types(find(names=="Test"))
dims(find(names=="i"))```
```--> [names,types,dims,vols] = listvarinfile(File);
Name                     Type           Size            Bytes
-------------------------------------------------------------
C                        cell           2 by 2          76
L                        list           4               51
M                        macro          1 by 1          0
S                        struct         4 by 2          8
Test                     macro          1 by 1          0
b                        boolean        2 by 3          24
c                        double         3 by 3          144
g                        handle         1 by 2          0
i                        integer        3 by 4 by 2     192
p                        polynomial     1 by 4          80
r                        tlist          4               162
sp                       sparse         10 by 15        232
spb                      boolean sparse 10 by 15        624
t                        string         2 by 2          40

--> types(find(names=="Test"))
ans  =
13.

--> dims(find(names=="i"))
ans  =
3.   4.   2.
```

参照

• save — Saves some chosen variables in a binary data file
• load — Loads some archived variables, a saved graphic figure, a library of functions
• save_format — "save"で作成されるファイルの形式
• type — 変数の型を返す
• whos — 長い形式で変数のリストを得る
• who — 変数の一覧

履歴

 Version Description 6.0 Hypermatrices are now listed with the type of their content, instead of "mlist" and type 17. Their sizes are now the actual ones, instead of 3. Cells and Structures arrays now appear as "cell" and "struct" instead of "mlist". Their sizes are now the actual ones, instead of 3. Arrays of graphic handles now appear as "handle" and type 9, instead of "tlist" and type 16. Their sizes are now the actual ones, instead of 3. Macros now appear as "macro" and type 13, instead of "tlist" and type 16. Real and complex numbers now appear as "double" instead of "constant".

 Report an issue << %io Files : Input/Output functions mclearerr >>

 Scilab EnterprisesCopyright (c) 2011-2017 (Scilab Enterprises)Copyright (c) 1989-2012 (INRIA)Copyright (c) 1989-2007 (ENPC)with contributors Last updated:Tue Feb 25 08:53:22 CET 2020