Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Français

Change language to:
English - 日本語 - Português - Русский

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

Aide de Scilab >> Matlab : fichiers données (R/W) > matfile_listvar

matfile_listvar

Lists variables of a Matlab binary MAT-file.

Syntax

[names, classes, types] = matfile_listvar(fd)

Arguments

fd

file identifier (integer) as returned by matfile_open.

names

column of strings: names of the variables stored in the file.

types

column of integers: Matlab data type of the variables.

classes

column of integers: Matlab class of the variables.

Type name Matlab class Matlab type Scilab type/inttype
cell 12117
struct 22217
text 4 10
sparse 5 5
double real|complex 69 1
single real|complex 77NA
int8 818/1
uint8 928/11
int16 1038/2
uint16 1148/12
int32 1258/4
uint32 1368/14
int64 14128/8
uint64 15138/18

Description

Lists variables of a Matlab binary MAT-file opened with matfile_open.

Returns empty matrices if the file contains no variables.

Examples

// Preparing some data:
H = rand(2,4,2);
N = complex(rand(2,3), rand(2,3));
I = int8(grand(4,10,"uin",-100,100));
T = ["foo" "bar"]';
S = struct("num",H, "imag",N, "text",T, "int",I);
C = {"Scilab", rand(2,3); H, S};

// Saving them:
File = TMPDIR+"/matfile_listvar_example.mat";
savematfile(File,'-v7.3', 'H','N','I','T','S','C');

// Listing stored variables:
fd = matfile_open(File);
[names, classes, types] = matfile_listvar(fd);
matfile_close(fd);

sleep(1000)
deletefile(File);

names', classes', types'
mprintf("The variable ""%s"" has type %d and class %d\n", names, types, classes)
--> names', classes', types'
 ans  =
!C  H  I  N  S  T  !

 ans  =
   1.   6.   8.   6.   2.   4.

 ans  =
   21.   9.   1.   9.   22.   2.

--> mprintf("The variable ""%s"" has type %d and class %d\n", names, types, classes)
The variable "C" has type 21 and class 1
The variable "H" has type 9 and class 6
The variable "I" has type 1 and class 8
The variable "N" has type 9 and class 6
The variable "S" has type 22 and class 2
The variable "T" has type 2 and class 4

See also

Bibliography

This function uses the external MATIO library ( http://sourceforge.net/projects/matio/ ).

Report an issue
<< matfile_close Matlab : fichiers données (R/W) matfile_open >>

Copyright (c) 2022-2024 (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:
Tue Feb 25 08:50:45 CET 2020