Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - 日本語

Change language to:
English - Français - 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

Scilabヘルプ >> Matlab binary files I/O > matfile_varreadnext

matfile_varreadnext

Matlab バイナリ MATファイルの次の変数を読み込む.

呼び出し手順

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

引数

fd

実数: (matfile_openにより返された)ファイル記述子.

name

文字列: 読み込んだ変数の名前または "" (読み込みに失敗した場合).

value

任意のScilab型: 読み込んだ変数の値または空の行列(読み込みに失敗した場合).

vartype

実数: 変数の型(読み込みに成功した場合)または:

  • 0: 変数の型が不明の場合.
  • -1: ファイル終端に達した場合.
Please see matfile_listvar for the list of Matlab types.

説明

matfile_openにより開かれた Matlabバイナリ MATファイルの次の変数を読み込みます.

// 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');

// Reading variables one by one:
fd = matfile_open(File, "r", "7.3");

//-- Loop on the stored variables
while %t
   [Name, Value, Type] = matfile_varreadnext(fd);
   if Type<0 then
      break
   else
      mprintf("The variable ""%s"" has type %d and contains\n", Name, Type);
      disp(Value);
   end
end
matfile_close(fd);
sleep(2000)
deletefile(File)
--> // Reading variables one by one:
--> fd = matfile_open(File, "r", "7.3");

--> //-- Loop on the stored variables
--> while %t
  >    [Name, Value, Type] = matfile_varreadnext(fd);
  >    if Type<0 then
  >       break
  >    else
  >       mprintf("The variable ""%s"" has type %d and contains\n", Name, Type);
  >       disp(Value);
  >    end
  > end
The variable "C" has type 1 and contains

  [  1x1 string  ]  [2x3 constant]
  [2x4x2 constant]  [1x1 struct  ]

The variable "H" has type 6 and contains

(:,:,1)
   0.2113249   0.0002211   0.6653811   0.8497452
   0.7560439   0.3303271   0.6283918   0.685731
(:,:,2)
   0.8782165   0.5608486   0.7263507   0.5442573
   0.068374    0.6623569   0.1985144   0.2320748

The variable "I" has type 8 and contains

  100  51 -52  92  17  34 -94 -30  36 -30
  -70 -72  -9 -19 -78 -15   1 -53 -23  91
   76 -83  93 -23  63 -80 -69  86  -7  57
   25  31  58 -64 -96  -9 -70  -4 -66 -34

The variable "N" has type 6 and contains

   0.2312237 + 0.2146008i   0.8833888 + 0.3616361i   0.3076091 + 0.5664249i
   0.2164633 + 0.312642i    0.6525135 + 0.2922267i   0.9329616 + 0.4826472i

The variable "S" has type 2 and contains

  num: [2x4x2 constant]
  imag: [2x3 constant]
  text: [2x1 string]
  int: [4x10 int8]

The variable "T" has type 4 and contains

!foo  !
!bar  !

参照

  • matfile_open — Matlab バイナリ MAT-ファイルを開く.
  • matfile_close — Matlab バイナリ MATファイルを閉じる.
  • matfile_varwrite — Matlab バイナリ MATファイルに変数を書き込む.
  • matfile_listvar — Matlab バイナリ MATファイルの中の変数の一覧を得る.

参考文献

この関数はMATIOライブラリ ( http://sourceforge.net/projects/matio/ )を使用しています.

Report an issue
<< matfile_open Matlab binary files I/O matfile_varwrite >>

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:
Thu Feb 14 15:02:37 CET 2019