Function ndarray_npy::write_npy [−][src]
pub fn write_npy<P, T>(path: P, array: &T) -> Result<(), WriteNpyError> where
P: AsRef<Path>,
T: WriteNpyExt,
Expand description
Writes an array to an .npy
file at the specified path.
This function will create the file if it does not exist, or overwrite it if it does.
This is a convenience function for BufWriter::new(File::create(path)?)
followed by WriteNpyExt::write_npy
.
Example
use ndarray::array;
use ndarray_npy::write_npy;
let arr = array![[1, 2, 3], [4, 5, 6]];
write_npy("array.npy", &arr)?;