In C, I might do something like this:
#define MAGIC_NUMBER (88)
int foo(int a, int b, int c) {
return a + b + c + MAGIC_NUMBER;
}
double bar(double x, double n) {
return x + n + MAGIC_NUMBER;
}
/*
* ...and so on with many kind-of-long functions using
* MAGIC_NUMBER instead of writing a literal 88 like so:
*/
double bar(double x, double n) {
return x + n + 88;
}
What should I do in Matlab? (Needs to work across multiple files.)
You can define a global variable
or declare a function which simply returns a constant value (the second possibility looks better).