function [neg_on_err] = pb_fft_find_resonance(num_points, SF, SW, real_data, imag_data)
% FUNCTION NAME:
%   pb_fft_find_resonance
%
% DESCRIPTION:
%   Calculates the Fourier transform of a given set of real and imaginary points
%
% INPUTS:
%   n - Number of points for FFT.
%   real_in - Array of real points for FFT calculation
%   imag_in - Array of imaginary points for FFT calculation
%   real_out - Real part of FFT output
%   imag_out - Imaginary part of FFT output
%   mag_fft - Magnitude of the FFT output
%
% OUTPUTS:
%   neg_on_err - Returns zero.
%
% $Revision: R2017a$ 
% $Author: SpinCore Technologies, Inc.$
% $Date: November 17, 2023$
% ------------------------------------------------------------------------------

global SPINAPI_DLL_NAME;

% Assign the memory address of the c_data array to the pointer argument
real_pointer = libpointer('int16Ptr', real_data);
imag_pointer = libpointer('int16Ptr', imag_data);

r_dat = real_pointer.Value;
i_dat = imag_pointer.Value;

neg_on_err = calllib(SPINAPI_DLL_NAME, 'pb_fft_find_resonance', num_points, SF, SW, r_dat, i_dat);

end

