Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Arquivos : funções de Entrada/Saída > listvarinfile

listvarinfile

lists variables stored in a binary archive (names, types, sizes..)

Syntax

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

Arguments

filename

a character string, the pathname of the file to be inspected.

nams

a matrix of strings, names of the variables saved in the file.

dims

a list, dimensions of the variables saved in the file.

typs

a numeric matrix, types of the variables saved in the file.

vols

a numeric matrix, size in bytes of the variables saved in the file.

Description

This utility function lists "a la whos" the variables stored in a Scilab data file created with save.

Rationals and state-space linear systems are reported as plain tlists

Examples

// 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.

See also

  • 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 — format of files produced by "save"
  • type — tipo de variável
  • whos — listing of variables in long form
  • who — listagem de variáveis

History

VersãoDescrição
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
<< listfiles Arquivos : funções de Entrada/Saída mclearerr >>

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:
Thu Feb 14 15:00:46 CET 2019