I believe you've just made a syntax error by leaving out &&
between the two inequality operators. If I understand your question, you should have functions defined as follows:
ClearAll[a, b, func];
a[x_Real] :=(* example calc *)-1*x;
b[x_Real] :=(* example calc *)x;
func[table_?(MatrixQ[#, NumericQ] &), x_] :=
Cases[table, {n_, __} /; a[x] < n && b[x] > n];
...with an example in this case of a simple filtering operation on a matrix shown as follows:
First, let's create some data. This creates a real-valued matrix:
temp = Table[RandomReal[{-1, 1}], {i, 1, 5}, {j, 1, 5}];
To work with the same data, here's what I see:
temp = {{-0.19773, -0.403283, -0.203482,
0.560051, -0.662339}, {-0.229652, -0.382093, -0.369309, 0.576484,
0.566491}, {0.30776, 0.471342, 0.556337, 0.997326,
0.749479}, {0.951397, 0.256563,
0.740539, -0.9422, -0.552236}, {0.937068, 0.903586, -0.0219966,
0.917632, 0.0494045}};
Now call func
on the temp
variable with some real value in place of x
as follows:
func[temp, .3]
...which returns
{{-0.19773, -0.403283, -0.203482,
0.560051, -0.662339}, {-0.229652, -0.382093, -0.369309, 0.576484,
0.566491}}
You can see that func
"filtered" the rows using the functions a
and b
(I'm just using your function names here for comparability sake) as well as the pattern variable n
.
SetDelayed
..:=
(otherwise your pattern syntax looks correct) $\endgroup$n_
in the program, I somehow deleted it when pasting it here $\endgroup$Array
function, which is not used in posted code. $\endgroup$