Loading [MathJax]/extensions/tex2jax.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

NotesParametersReturns
whosmat(file_name, appendmat=True, **kwargs)

Notes

v4 (Level 1.0), v6 and v7 to 7.2 matfiles are supported.

You will need an HDF5 python library to read matlab 7.3 format mat files (e.g. h5py). Because SciPy does not supply one, we do not implement the HDF5 / 7.3 interface here.

Parameters

file_name : str

Name of the mat file (do not need .mat extension if appendmat==True) Can also pass open file-like object.

appendmat : bool, optional

True to append the .mat extension to the end of the given filename, if not already present. Default is True.

byte_order : str or None, optional

None by default, implying byte order guessed from mat file. Otherwise can be one of ('native', '=', 'little', '<', 'BIG', '>').

mat_dtype : bool, optional

If True, return arrays in same dtype as would be loaded into MATLAB (instead of the dtype with which they are saved).

squeeze_me : bool, optional

Whether to squeeze unit matrix dimensions or not.

chars_as_strings : bool, optional

Whether to convert char arrays to string arrays.

matlab_compatible : bool, optional

Returns matrices as would be loaded by MATLAB (implies squeeze_me=False, chars_as_strings=False, mat_dtype=True, struct_as_record=True).

struct_as_record : bool, optional

Whether to load MATLAB structs as NumPy record arrays, or as old-style NumPy arrays with dtype=object. Setting this flag to False replicates the behavior of SciPy version 0.7.x (returning numpy object arrays). The default setting is True, because it allows easier round-trip load and save of MATLAB files.

Returns

variables : list of tuples

A list of tuples, where each tuple holds the matrix name (a string), its shape (tuple of ints), and its data class (a string). Possible data classes are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, single, double, cell, struct, object, char, sparse, function, opaque, logical, unknown.

List variables inside a MATLAB file.

Examples

from io import BytesIO
import numpy as np
from scipy.io import savemat, whosmat
Create some arrays, and use `savemat` to write them to a ``BytesIO`` instance.
a = np.array([[10, 20, 30], [11, 21, 31]], dtype=np.int32)
b = np.geomspace(1, 10, 5)
f = BytesIO()
savemat(f, {'a': a, 'b': b})
Use `whosmat` to inspect ``f``. Each tuple in the output list gives the name, shape and data type of the array in ``f``.
whosmat(f)
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/io/matlab/_mio.py#303
type: <class 'function'>
Commit: