bundles / scipy 1.17.1 / scipy / io / matlab / _mio5_utils / VarReader5 / read_numeric
cython_function_or_method
scipy.io.matlab._mio5_utils:VarReader5.read_numeric
Signature
def read_numeric ( self , copy = True , nnz = -1 ) Summary
Read numeric data element into ndarray
Extended Summary
Reads element, then casts to ndarray.
The type of the array is usually given by the mdtype returned via read_element. Sparse logical arrays are an exception, where the type of the array may be np.bool_ even if the mdtype claims the data is of float64 type.
Parameters
copy: bool, optionalWhether to copy the array before returning. If False, return array backed by bytes read from file.
nnz: int, optionalNumber of non-zero values when reading numeric data from sparse matrices. -1 if not reading sparse matrices, or to disable check for bytes data instead of declared data type (see Notes).
Returns
arr: arrayNumeric array
Notes
MATLAB apparently likes to store sparse logical matrix data as bytes instead of miDOUBLE (float64) data type, even though the data element still declares its type as miDOUBLE. We can guess this has happened by looking for the length of the data compared to the expected number of elements, using the nnz input parameter.
Aliases
-
scipy.io.matlab._mio5.VarReader5.read_numeric