summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/fDeepCopyRange.c
blob: e9a2b2940217ec89fdac7505b945a81a1dd81879 (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
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include "sdvbs_common.h"

F2D* fDeepCopyRange(F2D* in, int startRow, int numberRows, int startCol, int numberCols)
{
    int i, j, k;
    F2D *out;
    int rows, cols;
    
    rows = numberRows + startRow;
    cols = numberCols + startCol;
    out = fMallocHandle(numberRows, numberCols);
    
    k = 0;
    for(i=startRow; i<rows; i++)
        for(j=startCol; j<cols; j++)
            asubsref(out,k++) = subsref(in,i,j);
    
    return out;
    
}