function [neg_on_err] = pb_write_felix(fnameout, title_string, num_points, SW, SF, real_data, imag_data)
% FUNCTION NAME:
%   pb_write_felix
%
% DESCRIPTION:
%   Write the RAM contents to a Felix file.
% 
% INPUTS:
%   fnameout - The filename for the Felix file you want to create
%
%   title_string - Large string with all parameter information to include in 
%                  Felix Title Block
%
%   num_points - Number of points to write to the file
%
%   SW - Spectral width of the baseband data in Hz
%
%   SF - Spectrometer frequency in MHz
%
%   real_data - Integer array containing the real portion of the data points
%
%   imag_data - Integer array containing the imaginary portion of the data points
%
% OUTPUTS:
%   neg_on_err - A negative number is returned on failure, and spinerr is set
%                to a description of the error. 0 is returned on success. 
%
% $Revision: R2017a$ 
% $Author: SpinCore Technologies, Inc.$
% $Date: November 17, 2023$
% ------------------------------------------------------------------------------

global SPINAPI_DLL_NAME;

fnameout = char(fnameout);
title_string = char(title_string);

neg_on_err = calllib(SPINAPI_DLL_NAME, 'pb_write_felix', fnameout, title_string, num_points, SW, SF, real_data, imag_data);

end