pub fn new<S: Into<String>>(name: S, data: &[T]) -> Result<Self> {
        let c_name = std::ffi::CString::new(name.into())?;
        let mut dims = [1, data.len() as u64];
        let matvar_t = unsafe {
            ffi::Mat_VarCreate(
                c_name.as_ptr(),
                <T as DataType>::mat_c(),
                <T as DataType>::mat_t(),
                2,
                dims.as_mut_ptr(),
                data.as_ptr() as *mut std::ffi::c_void,
                0,
            )
        };
        if matvar_t.is_null() {
            Err(MatioError::MatVarCreate(
                c_name.to_str().unwrap().to_string(),
            ))
        } else {
            Ok(MatVar {
                matvar_t,
                data_type: PhantomData,
            })
        }
    }
/// Creates a new Matlab variable `name`
Creates a new Matlab variable `name`
Creates a new Matlab variable ` name `
pub fn new<S: Into<String>>(name: S, data: &[T]) -> Result<Self> {
        let c_name = std::ffi::CString::new(name.into())?;
        let mut dims = [1, data.len() as u64];
        let matvar_t = unsafe {
            ffi::Mat_VarCreate(
                c_name.as_ptr(),
                <T as DataType>::mat_c(),
                <T as DataType>::mat_t(),
                2,
                dims.as_mut_ptr(),
                data.as_ptr() as *mut std::ffi::c_void,
                0,
            )
        };
        if matvar_t.is_null() {
            Err(MatioError::MatVarCreate(
                c_name.to_str().unwrap().to_string(),
            ))
        } else {
            Ok(MatVar {
                matvar_t,
                data_type: PhantomData,
            })
        }
    }
pub fn new < S : Into < String > > ( name : S , data : & [ T ] ) -> Result < Self > { let c_name = std :: ffi :: CString :: new ( name . into ( ) ) ? ; let mut dims = [ 1 , data . len ( ) as u64 ] ; let matvar_t = unsafe { ffi :: Mat_VarCreate ( c_name . as_ptr ( ) , < T as DataType > :: mat_c ( ) , < T as DataType > :: mat_t ( ) , 2 , dims . as_mut_ptr ( ) , data . as_ptr ( ) as * mut std :: ffi :: c_void , 0 , ) } ; if matvar_t . is_null ( ) { Err ( MatioError :: MatVarCreate ( c_name . to_str ( ) . unwrap ( ) . to_string ( ) , ) ) } else { Ok ( MatVar { matvar_t , data_type : PhantomData , } ) } }
Creates a new Matlab variable `name`
Creates a new Matlab variable ` name `
name
S
data
&[T]
name
S
data
&[T]