O
Olaf P.
Hi,
I'm writing an FIR filter. The coeffs for low/high/band pass and band
stop (LP,HP,BP,BS) are calculated by matlab and exported as header, e.g.
const int LP_SZ = 33;
const real64_T LP_H[33] = { ... };
const int HP_SZ = 33;
const real64_T HP_H[33] = { ... };
const int BP_SZ = 33;
const real64_T BP_H[33] = { ... };
const int BS_SZ = 33;
const real64_T BS_H[33] = { ... };
Now I want to initialize a new array like:
const real64_T H[4][33] = { LP_H, HP_H, BP_H, BS_H };
which doesn't compile; The error is
fir.h:29: error: initializer element is not constant
fir.h:29: error: (near initialization for `H[0]')
How can I get this to compile, is there a way? Writing
const real64_T H[4][33] = { {...}, {...}, {...}, {...} };
would work, but by change some parameters for FIR filter coeffs I have
to copy & paste it each time again.
The goal ist to use the filter coeffs e.g. in the manner of
int filter_type = 0; // aka LP
filter_fir(H[filter_type], ...);
Thanks
Olaf
I'm writing an FIR filter. The coeffs for low/high/band pass and band
stop (LP,HP,BP,BS) are calculated by matlab and exported as header, e.g.
const int LP_SZ = 33;
const real64_T LP_H[33] = { ... };
const int HP_SZ = 33;
const real64_T HP_H[33] = { ... };
const int BP_SZ = 33;
const real64_T BP_H[33] = { ... };
const int BS_SZ = 33;
const real64_T BS_H[33] = { ... };
Now I want to initialize a new array like:
const real64_T H[4][33] = { LP_H, HP_H, BP_H, BS_H };
which doesn't compile; The error is
fir.h:29: error: initializer element is not constant
fir.h:29: error: (near initialization for `H[0]')
How can I get this to compile, is there a way? Writing
const real64_T H[4][33] = { {...}, {...}, {...}, {...} };
would work, but by change some parameters for FIR filter coeffs I have
to copy & paste it each time again.
The goal ist to use the filter coeffs e.g. in the manner of
int filter_type = 0; // aka LP
filter_fir(H[filter_type], ...);
Thanks
Olaf