MATWHO is a MEX file wrapper around the MEX function 'matGetDir' provided in the 'MAT-File Library' by The MathWorks. It lists the variables stored in a .MAT file, similar to using the 'who' function with the location set to '-file', but much faster, particularly on large .MAT files. MATWHO does not support pattern matching on the variable names, it only returns the complete list of variables. It is equivalent to calling: c = who('-file','filename');
This function resulted from a discussion on comp.soft-sys.matlab.
My thanks to Friedrich and James Tursa for their contributions and feedback.
This function must be compiled prior to use. Once you've set up a mex compiler, this is done by calling:
I've successfully tested this function on both Linux (Ubuntu), Windows XP (32 bit), and Windows 7 (64 bit), but it should work on any system.
c = matwho('filename')
filename - Name of the '.mat' file to read.
c = Cell array of strings that correspond to each variable name.
Benjamin Kraus (2021). matwho (https://www.mathworks.com/matlabcentral/fileexchange/42159-matwho), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!