Skip to content

Trying to convert mf array to ndarray #8

@SaladDressings

Description

@SaladDressings

Hello!

Got a problem with trying to convert from a matfile array to an nd Array
My code:

use std::convert::TryInto;

 fn main() { 
   let file = matfile::MatFile::parse(std::fs::File::open("hrir_mp_4096.mat").unwrap()).unwrap();  
   let arr = file.find_by_name("hrir_mp_4096").unwrap();
   let hrir_mp: ndarray::Array2<f32> = arr.try_into().unwrap();
}

I get this error:
the trait 'From<&Array>' is not implemented for 'ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>', which is required by 'ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>: TryFrom<&Array>'
I have absolutely no idea where the 'From<&Array>' is coming from. Why does it wrap arr into From?

Help would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions