1

I have written a function for FIR Filter which has an array as input and another array as output.This is my FIR Filter function here:

float   * filter(float PATIENTSIGNAL[],float FILTERCOEF[])

I can use it without any problem, like the way hereunder:

float   *FILTEROUT;
float   FIROUT[8000];

FILTEROUT = filter(PATIENTSIGNAL, FILTERCOEF);

    /*              */
    for (k = 0; k <= 1000; k++){
        FIR[k] = 10 + FILTEROUT[k];
    } 

As you see I added number 10 to each element of my output array to evaluate that can I use this array for future computation,

But Here is my problem when I want use 2D array, This my function which return a 2D array correctly;

float(*Windowing(float SIGNAL[], int WINDOWSIZE));

I have used the Windowing function by this code in appropriate way:

patientwindow = Windowing(FILTEROUT, WINDOWSIZE);

and the all numbers in "patientwindow" array is correct but when I want to perform some simple operation like summation as here:

float evaluate[WINDOWSIZE][OVERLAP/4];

for (j = 0; j <= NUMBEROFWINDOWS; j++){
        for (i = 0; i < WINDOWSIZE; i++){

            evaluate[i][j] = 2+ (patientwindow[i][j]);

        }
    }

all elements of "evaluate" array are 0;

Would you please help me?

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
omid
  • 11
  • 2

1 Answers1

0

use

float** patientwindow;

float* is a pointer to array whereas float** is a pointer to matrix (for why is that the case see this answer https://stackoverflow.com/a/17953693/4996826 ).

If you want to use float* , then use following snippet of code:

evaluate[i][j] = 2 + (patientwindow[(i * NUMBEROFWINDOWS) + j]);
Community
  • 1
  • 1
Sahil
  • 11
  • 3