Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - 日本語 -
Справка Scilab >> Matlab binary files I/O > matfile_varreadnext

matfile_varreadnext

Reads next variable in a Matlab binary MAT-file.

Syntax

[name[, value[, vartype]]] = matfile_varreadnext(fd)

Arguments

fd

Real: file descriptor (returned by matfile_open).

name

String: name of the variable read or "" if reading failed.

value

Any Scilab type: value of the variable read or an empty matrix if reading failed.

vartype

Real: type of the variable if reading succeeds or:

  • 0: if the variable type is unknown.

  • -1: if end of file has been reached.

Description

Reads next variable in a Matlab binary MAT-file opened by matfile_open.

Examples

A = rand(10,10);
B = sprand(10,10,0.1);
C = "foo";
D = "bar";
savematfile('test_matfile.mat','A','B','C','D','-v6');
clear();
fd = matfile_open("test_matfile.mat");
//-- Loop on the stored variables
while %t
   [Name, Value, Type] = matfile_varreadnext(fd);
   if Name == "" then
      break;
   else
      disp("The variable " + Name + " has type " + string(Type) + " and contains:");
      disp(Value);
   end
end
matfile_close(fd);

See also

Bibliography

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

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:13:37 CET 2017