Updated 30 Apr 2019
This repository collects matlab functions which belong to no specific
topic. It collects functions which are used in *general*.
It currently includes the following functions:
* **count2log10**: a helper function to scale counting matrices using log10; it further delets all 0 entries and replaces it with eps.
* **isEven**: a helper function which checks if a numbe is even.
* **isOdd**: a helper function which checks if a numbe is odd.
* **StringMustBeMember**: checks if a sttring is within a list of strings
This toolbox is also mirrored to the [Matlab File Exchange](https://de.mathworks.com/matlabcentral/profile/authors/3965795-roland).
It is heavily used in the [mdtsToolbox](https://github.com/RolandRitt/Matlab-mdtsToolbox).
Roland (2020). Matlab-general (https://github.com/RolandRitt/Matlab-general), GitHub. Retrieved .
All the function StrMustBeMember does is calling mustBeMember. Then the potentially occurring error is caught and a new exception is created. On success TRUE is replied, on failure and error is thrown. So why not calling mustBeMember directly?
The functions isEven and isOdd are complex and slow: two intermediate variables, one output variable, totally superfluous FIND. They also return numeric outputs rather than logical outputs. Ouch.
The standard MATLAB code for checking for odd/even integer values is simpler and more efficient:
mod(A,2)==1 % is odd
mod(A,2)==0 % is even
The function count2log10 is of questionable numeric value: it arbitrarily changes some values into other values, e.g.:
>> V = 0:0.25:2
0.00000 0.25000 0.50000 0.75000 1.00000 1.25000 1.50000 1.75000 2.00000
>> count2log10(V) % note 5th element is EPS, not ZERO.
0.00000 -0.60206 -0.30103 -0.12494 0.00000 0.09691 0.17609 0.24304 0.30103
>> log10(V) % correct values (note -Inf and ZERO values).
-Inf -0.60206 -0.30103 -0.12494 0.00000 0.09691 0.17609 0.24304 0.30103
There is no explanation given as to *why* some values deserve to be changed arbitrarily. It certainly does not make much sense for numeric calculations.