summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/writeMatrix.c
blob: a4577349624f7d9ab3d6623e46a72cc44a63156a (plain) (blame)
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
29
30
31
32
33
34
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include <stdio.h>
#include <stdlib.h>
#include "sdvbs_common.h"

void writeMatrix(I2D* input, char* inpath)
{
    FILE* fp;
    char im[100];
    int rows,cols, i, j;

    sprintf(im, "%s/expected_C.txt", inpath);
    fp = fopen(im, "w");

    rows = input->height;
    cols = input->width;

    for(i=0; i<rows; i++)
    {
        for(j=0; j<cols; j++)
        {
            fprintf(fp, "%d\t", subsref(input, i, j));
        }
        fprintf(fp, "\n");
    }

    fclose(fp);
}