Thanks for the reply everyone. I now have that working. I'm still
having some trouble though.
Basically, what I'm trying to do, is implement a filter in labview,
which I have currently working in C.
This is the code I'm trying to implement -
/////////////////////////////////////////////////////////////////
filterInit(1200,filter2,b);
for(i=0;i mix2[i] = filterLP(mix2[i], filter2, b);
// filterLP
double filterLP(double x, double *filter, double *b)
{
double sum= 0.0; int i;
for (i = 0; i < FL-1; i++)
*(filter+i) = *(filter+i+1);
*(filter+FL-1) = x;
for (i = 0; i < FL; i++)
sum += ((*(b+i)) * (*(filter+i)));
return sum;
}
/////////////////////////////////////////////////////////////////
In labview, I now have a filterInit subVI which creates and
initializes the filter array to all zeros, and populates the b array.
I also have a second subVI called filterLP, which implements the
filterLP function coded above in C.
Now my problem is with respect to the these lines of code -
for(i=0;i mix2[i] = filterLP(mix2[i], filter2, b);
For the first iteration of this for loop, I want to use the
initialised filter array (all zeros), i.e. the one coming from my
filterInit subVI. But for all other iterations, I want to use the new
filter array values as they are updated by the filterLP subVI.
To do this, I had the filterLP subVI having an input called filterIn
and an output called filterOut (filter array in and out respectively).
I then thought I could call the filterLP subVI from within a for loop
- feeding the filterOut back into the filterIN. But this isn't
allowed, its a chain.
How might I implement this?
Thanks, and I appreciate your help,
Barry.
Aderogba wrote in message news:<5065000000050000009EC30000-1042324653000@exchange.ni.com>...
> To support the ealier response, implementing your code as it is right
> now will replace all filter array elements with the 0th element. I'm
> sure this is not what you want.