diff --git a/src/lib.rs b/src/lib.rs
index aec1000159218dc58f45074116c40860793175ec..218efaaeee664e699a7a728b7140160953f2ce79 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -135,7 +135,7 @@ fn read_from_serial(mut outputs: Output<'_>, args: Args<'_>) -> SResult<()> {
     args.assert_params_max_len(1)?;
 
     // Get the number of doubles to read from the input argument
-    let arg: f64 = args
+    let arg: f32 = args
         .get(1, Error::MissingReadAmount)?
         .into_rust()
         .map_mexerr(|e| Error::InvalidReadAmount(Box::new(e)))?;
@@ -152,8 +152,8 @@ fn read_from_serial(mut outputs: Output<'_>, args: Args<'_>) -> SResult<()> {
     let bytes = SERIAL.read().unwrap().read_n_bytes(n_doubles * 8)?;
     let doubles = bytes
         .chunks_exact(8)
-        .map(|chunk| f64::from_be_bytes(chunk.try_into().unwrap()))
-        .collect::<Vec<f64>>();
+        .map(|chunk| f32::from_be_bytes(chunk.try_into().unwrap()))
+        .collect::<Vec<f32>>();
     warn_debug!("Read {} bytes from serial port", n_doubles);
 
     outputs.set(doubles.to_vec())?;
@@ -165,7 +165,7 @@ fn write_to_serial(args: Args<'_>) -> SResult<()> {
     args.assert_params_max_len(1)?;
 
     // Get the doubles to write from the input argument
-    let data: Vec<f64> = args
+    let data: Vec<f32> = args
         .get(1, Error::MissingWriteData)?
         .into_rust()
         .map_mexerr(|e| Error::InvalidWriteData(Box::new(e)))?;
diff --git a/src/types.rs b/src/types.rs
index 04b28f957757b53aca23525be2a918372105cd16..c2e78b2b3479d490edf5e0ccdbc17dc3ecb3d2dd 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -54,6 +54,18 @@ impl IntoRustType<f32> for MxArray {
     }
 }
 
+impl IntoRustType<Vec<f32>> for MxArray {
+    fn into_rust(self) -> SResult<Vec<f32>> {
+        let out = Numeric::<f32, _>::from_mx_array(self)
+            .mexerr(Error::InvalidMatlabType(
+                "use a numerical type instead".into(),
+            ))?
+            .data()
+            .to_owned();
+        Ok(out)
+    }
+}
+
 impl IntoRustType<Vec<f64>> for MxArray {
     fn into_rust(self) -> SResult<Vec<f64>> {
         let out = Numeric::<f64, _>::from_mx_array(self)