The Convenience folder contains a number of convenience functions for checking information or manipulating math expressions.
Function are:
Takes
Returns
NOTE: This is identical to the function isValidUnitKind
Takes
Returns
EXAMPLE:
newArray = LoseWhiteSpace(' exa mp le')
newArray = 'example'
Takes
Returns
EXAMPLE:
pairs = PairBrackets('(a+((b*c)/(a+b)))')
pairs =
1 17
4 16
5 9
11 15
Takes
Returns
EXAMPLE:
output = Rearrange('X + Y - Z', 'X')
output = '-Y+Z'
Takes
Returns
EXAMPLE:
newArray = RemoveDuplicates([2, 3, 4, 3, 2, 5])
newArray = [2, 3, 4, 5]
Takes
Returns
EXAMPLE:
Consider m to be an SBMLModel containing a species with
id = 'g' and initialConcentration = '3'
value = Substitute('g*2', m)
value = 6
Takes
Returns
EXAMPLE:
Consider m to be an SBMLModel containing a parameter
with id = 'g', constant = '1' and value = 3'
newExpression = SubstituteConstants('2 * g * S1', SBMLModel)
newExpression = '2 * 3 * S1'
Takes
Returns
EXAMPLE:
Consider fD to be an SBMLFunctionDefinition
with id = 'g' and math = 'lambda(x,x+0.5)'
formula = SubstituteFormula('g(y)', fD)
formula = 'y+0.5'
formula = SubstituteFormula('h(y)', fD)
formula = ''
Takes
Returns
EXAMPLE:
y = isIntegralNumber(int32(3))
y = 1
y = isIntegralNumber(double(3.2))
y = 0
y = isIntegralNumber(double(3))
y = 1
NOTE: The inbuilt 'isinteger' function only returns true if the number has been declared as having an integer type, whereas the default type for numbers in MATLAB is double. This function will return '1' if the number represents an integer.
Takes
returns
NOTE: This is identical to the function CheckValidUnitKind
Takes
Returns
EXAMPLE:
index = matchFunctionName('f*g', 'g')
index = []
index = matchFunctionName('add(d,g_1)', 'add')
index = 0
index = matchFunctionName('add(add(a,b), c)', 'add')
index = [1, 5]
NOTE: This differs from the 'strfind' function in that it checks that the name is used as a function call.
Takes
Returns
EXAMPLE:
index = matchName('f*g', 'g')
index = 3
index = matchName('f*g_1', 'g')
index = []
index = matchName('f*g(a,g)', 'g')
index = 7
NOTE: This differs from the 'strfind' function in that it checks that the name is used as a variable.
Takes
Returns
EXAMPLE:
value = piecewise(3, 1<2, 4)
value = 3
value = piecewise(3, 1>2, 4)
value = 4
NOTE: This function provides the functionality of the MathML 'piecewise' function.
Takes
Returns
NOTE: this function is necessary for octave to emulate the MATLAB functionality of the 'ismember' function