matrix_write

Digital Signal Processing Library

Voice Lab

Program name: matrix_write

Language: C

In file: file_lib.c

Objective: write matrix (array of vectors) to file.

Usage: void matrix_write(double **vector, int vector_width, int min, int max, char *file_name, int options);

Parameters:

  • vector - array of vetors to be written.
  • vector_width - number of elements in each vector.
  • min - where to start writing.
  • max - up to which vector should we save data
  • file_name - which file to write to
  • options - options to be passed to write_vector routine
Return:
  • void

Mathematical Description:

Comments: Routine to write list of vectors to file

User Comments

Code:

void matrix_write(double **vector, int vector_width, int min, int max, char *file_name, int options)
{
        int i;
        FILE *out_file;

        /* open output file for writing */
        if((out_file = fopen(file_name,"w")) == NULL) {
                fprintf(stderr, "Cannot open output file: %s\n", file_name);
                exit(1);
        }

        for(i = min; i < max; i++) {
                vector_write(vector[i], vector_width, out_file, options);
        }

        fclose(out_file);
        return;
}