aboutsummaryrefslogtreecommitdiff
path: root/octave/save_f32.m
diff options
context:
space:
mode:
authorAuthor Name <[email protected]>2023-07-07 12:20:59 +0930
committerDavid Rowe <[email protected]>2023-07-07 12:29:06 +0930
commitac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch)
treea2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /octave/save_f32.m
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'octave/save_f32.m')
-rw-r--r--octave/save_f32.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/octave/save_f32.m b/octave/save_f32.m
new file mode 100644
index 0000000..62214d4
--- /dev/null
+++ b/octave/save_f32.m
@@ -0,0 +1,12 @@
+% save_f32.m
+% David Rowe Sep 2021
+%
+% save a matrix to .f32 binary files in row-major order
+
+function save_f32(fn, m)
+ f=fopen(fn,"wb");
+ [r c] = size(m);
+ mlinear = reshape(m', 1, r*c);
+ fwrite(f, mlinear, 'float32');
+ fclose(f);
+endfunction