summaryrefslogtreecommitdiff
path: root/gr-utils/octave/write_short_binary.m
blob: 8c1ec6efc1ae96830feb1f0341a09d437eae5b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%
% Copyright 2001 Free Software Foundation, Inc.
%
% This file is part of GNU Radio
%
% SPDX-License-Identifier: GPL-3.0-or-later
%
%

function v = write_short_binary (data, filename)

  %% usage: write_short_binary (data, filename)
  %%
  %%  open filename and write data to it as 16 bit shorts
  %%

  if ((m = nargchk (2,2,nargin)))
    usage (m);
  endif;

  f = fopen (filename, "wb");
  if (f < 0)
    v = 0;
  else
    v = fwrite (f, data, "short");
    fclose (f);
  endif;
endfunction;