如何在不加载MATLAB的情况下检查MAT文件的内容?

如何在不加载MATLAB的情况下检查MAT文件的内容?

问题描述:

我的MAT文件结构很大.我想检查结构中是否存在特定字段,而无需加载MAT文件,因为内容非常大,并且我想最大程度地减少内存使用.

I have a large structure in a MAT-file. I want to check if a specific field is present in the structure without loading the MAT-file since the contents are very large and I want to minimize memory use.

这是否可行,还是必须像下面的示例一样首先加载它?

Is this possible, or must I load it first like in the following example?:

load('test.mat');             %# Load the MAT-file
tf = isfield(s,'fieldname');  %# Check if structure s has field 'fieldname'

要在不加载MAT文件的情况下检查其内容,请使用:

To check the contents of a MAT file without loading it, use:

vars = whos('-file','test.mat')
ismember('fieldname', {vars.name})