Input - output functions

Functions

int dspl_get_version (int printFlag)
 Get DSPL version. More...
 
int dspl_writebin (double *x, double *y, int n, char *fn)
 Save real or complex вектор to a bin-file fn More...
 
int dspl_writetxt (double *x, double *y, int n, char *fn)
 Save data to text file. More...
 

Detailed Description

Function Documentation

◆ dspl_get_version()

int dspl_get_version ( int  printFlag)

Get DSPL version.

This function return DSPL version

Parameters
[in]printFlagPrint DSPL version to console. DSPL version will be printed if printFlag is 1.
Returns
DSPL version in format 0x0000YYMM, here YY - year, MM - month of DSPL compilation. For example 0x00000F0B corresponds to 15.11
Author
Sergey Bakhurin. www.dsplib.org

◆ dspl_writebin()

int dspl_writebin ( double *  x,
double *  y,
int  n,
char *  fn 
)

Save real or complex вектор to a bin-file fn

This function writes real or complex vector [n x 1] to a bin-file fn.
File structure supports 1D and 2D arrays (vectors and matrices). File structure:

type 4 bytes type int. This parameter value can be DSPL_DAT_COMPLEX, if pointer y is not NULL, or DSPL_DAT_REAL, if pointer y is NULL.

n 4 bytes type int. Input array rows number.

m 4 bytes type int. Input array rows number. This parameter is 1 for 1D input array.

pR n*m*sizeof(double) Real part data.<BR

pI n*m*sizeof(double) Image part data if y is not NULL.

Writed file can be used for algorithm verification by an external program like GNU Octave or Matlab.

Parameters
[in]xFirst array pointer. Vector size is [n x 1].
[in]ySecond array pointer. Vector size is [n x 1]. Can be NULL. bin file will contain only x vector if y == NULL
[in]nInput vector size
[in]fnFile name
Returns
DSPL_OK if file has been saved successfully. DSPL_ERROR_PTR if x==NULL. DSPL_ERROR_SIZE if n<1. DSPL_ERROR_FNAME if fn==NULL. DSPL_ERROR_FOPEN if file fn cannot be created.
Author
Sergey Bakhurin. www.dsplib.org

◆ dspl_writetxt()

int dspl_writetxt ( double *  x,
double *  y,
int  n,
char *  fn 
)

Save data to text file.

This function saves a real or complex vector to the txt file fn.
Result file has format
x[0] y[0]
x[1] y[1]
...
x[n-1] y[n-1]

This file can be used for plotting data by external programs.

Parameters
[in]xFirst array pointer. Vector size is [n x 1].
[in]ySecond array pointer. Vector size is [n x 1]. Can be NULL. bin file will contain only x vector if y == NULL
[in]nInput vector size
[in]fnFile name
Returns
DSPL_OK if file has been saved successfully. DSPL_ERROR_PTR if x==NULL. DSPL_ERROR_SIZE if n<1. DSPL_ERROR_FNAME if fn==NULL. DSPL_ERROR_FOPEN if file fn cannot be created.
Note
This function rounds data for saving. So this function cannot be used for accuracy verification
Author
Sergey Bakhurin. www.dsplib.org
Examples:
dft_freq_fig1.c, dft_freq_fig4.c, goertzel_dtmf.c, hilbert_fft.c, resample_lagrange_ex_fs.c, resample_lagrange_ex_interp.c, resample_lagrange_filter_frac_delay.c, resample_lagrange_filter_interp.c, resample_spline_ex_fs.c, resample_spline_ex_interp.c, resample_spline_filter_frac_delay.c, and resample_spline_filter_interp.c.

Select spelling error with your mouse and press Система Orphus