Quantcast

Documentation Center

  • Trial Software
  • Product Updates

whos

Class: matlab.io.MatFile
Package: matlab.io

Names, sizes, and types of variables in MAT-file

Syntax

details = whos(matObj)
details = whos(matObj,variables)

Description

details = whos(matObj) returns information about all variables in the MAT-file associated with matObj.

details = whos(matObj,variables) returns information about the specified variables.

Input Arguments

matObj

Object created by the matfile function.

variables

Names of variables in the MAT-file corresponding to matObj. Use one of these forms:

var1,...,varNComma-separated list of variable name strings. Optionally, match patterns with the '*' wildcard, such as whos(matobj,'A*').
'-regexp',expressionsRegular expression strings that describe variable names.

Output Arguments

details

Structure array with these fields (identical to the structure returned by the whos function):

name

Variable name

size

Dimensions of the variable

bytes

Number of bytes allocated for the array when you load the entire variable

class

Class (data type) of the variable

global

Whether the variable is global (true or false)

sparse

Whether the variable is sparse

complex

Whether the variable is complex

nesting

Structure with these fields:

  • function — Name of the nested or outer function that defines the variable

  • level — Nesting level

persistent

Whether the variable is persistent

Examples

Display a list of variables in the example file topography.mat:

matObj = matfile('topography.mat');
whos(matObj)

This code returns:

  Name              Size              Bytes  Class     Attributes

  topo            180x360            518400  double              
  topolegend        1x3                  24  double              
  topomap1         64x3                1536  double              
  topomap2        128x3                3072  double              
 

Without loading any data, find the size and number of dimensions of the variable topo in topography.mat:

matObj = matfile('topography.mat');
info = whos(matObj,'topo');
sizeX = info.size
nDimsX = length(sizeX)

This code returns:

sizeX =
   180   360

nDimsX =
     2

See Also

|

Was this topic helpful?