getVarNumsAndMultiplier
getVarNumsAndMultiplier
getVarNumsAndMultiplier
Extract AND and NOT expressions from a transmission condition.
[andNums, andNotNums, multiplier] = getVarNumsAndMultiplier(q)
extracts the AND and NOT expressions from a transmission condition and returns the corresponding variable numbers. It also returns the multiplier for each term.
A valid transmission condition consists of terms that involve only AND and NOT expressions. For each term, the AND and NOT expressions are collected, and vectors of the respective variable numbers are returned.
Arguments
q
(Q): A transmission condition. See alsoQ
.
Returns
andNums
(cell array of vectors): Each cell contains a vector of variable numbers included via AND in the term.andNotNums
(cell array of vectors): Each cell contains a vector of variable numbers included via NOT in the term.multiplier
(vector of numbers): Contains the multiplier for each term.
##Example
q = Q({"x1", "!x2", "x1 & !x2"}, [1, 2, 3]);
[andNums, andNotNums, multiplier] = getVarNumsAndMultiplier(q);
% Output:
% andNums = { [1], [], [1] }
% andNotNums = { [], [2], [2] }
% multiplier = [1, 2, 3]
See also Q