matfile_listvar
Matlab バイナリ MATファイルの中の変数の一覧を得る.
呼び出し手順
[names, classes, types] = matfile_listvar(fd)
引数
- fd
実数: (matfile_openにより返された)ファイル記述子.
- names
文字列ベクトル: 変数名.
- types
実数ベクトル: 変数のデータ型.
- classes
実数ベクトル: 変数のクラス.
Type name Matlab class Matlab type Scilab type/inttype cell 1 21 17 struct 2 22 17 text 4 10 sparse 5 5 double real|complex 6 9 1 single real|complex 7 7 NA int8 8 1 8/1 uint8 9 2 8/11 int16 10 3 8/2 uint16 11 4 8/12 int32 12 5 8/4 uint32 13 6 8/14 int64 14 12 8/8 uint64 15 13 8/18
例
// 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
参照
- matfile_open — Matlab バイナリ MAT-ファイルを開く.
- matfile_close — Matlab バイナリ MATファイルを閉じる.
- matfile_varwrite — Matlab バイナリ MATファイルに変数を書き込む.
- matfile_varreadnext — Matlab バイナリ MATファイルの次の変数を読み込む.
参考文献
この関数はMATIOライブラリ (
http://sourceforge.net/projects/matio/
)を使用しています.
Report an issue | ||
<< matfile_close | Matlab binary files I/O | matfile_open >> |