Expand description
Helpers for converting between matfile::Array
and ndarray::Array
.
While matfile
arrays abstract over the underlying data type, ndarray
arrays are parameterized by a concrete data type. Thus the conversions
provided are fallible in case the data types are not compatible.
§Examples
First, bring the TryInto
trait into scope:
use matfile_ndarray::TryInto;
§Dynamically dimensioned arrays
Converting a matfile
array mf_arr
to a dynamic dimension ndarray
array
nd_arr
:
let nd_arr: ndarray::ArrayD<f64> = mf_arr.try_into()?;
§Statically dimensioned arrays
Converting a matfile
array mf_arr
to a static dimension ndarray
array
nd_arr
:
let nd_arr: ndarray::Array2<num_complex::Complex<f32>> = mf_arr.try_into()?;
Enums§
Traits§
- TryInto
- This trait is at the time of this writing a nightly-only experimental API and so we just replicate it here, so it will be easy to switch to it later on.