Crates.io | matfile-ndarray |
lib.rs | matfile-ndarray |
version | 0.2.0 |
source | src |
created_at | 2019-04-05 21:15:49.785768 |
updated_at | 2020-02-28 10:21:17.826887 |
description | Utility library to convert between matfile and ndarray array formats |
homepage | |
repository | https://github.com/dthul/matfile |
max_upload_size | |
id | 126052 |
size | 17,382 |
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.
First, bring the TryInto
trait into scope:
use matfile_ndarray::TryInto;
Converting a matfile
array mf_arr
to a dynamic dimension ndarray
array
nd_arr
:
let nd_arr: ndarray::ArrayD<f64> = mf_arr.try_into()?;
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()?;