aboutsummaryrefslogtreecommitdiff
path: root/octave/save_f32.m
blob: 62214d47a0061ff9e13d2b65f709a1fbe0194fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
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