| |
ID | STAT-31 |
Title | Use a variable in one unit as much as possible. |
Priority | Recommended |
Severity level | 8 |
Description | Use a variable in one unit as much as possible. Use a named constant for converting to another unit if conversion is truly necessary. |
Rationale | Maintain readability by using the same unit of measure throughout a function. |
halfLifeTime = 580; % [s]
halfLifeTime = halfLifeTime / 3600; % [h]
SECONDS_TO_HOURS = 1 / 3600;
halfLifeTime = 580; % [s]
halfLifeTime = halfLifeTime * SECONDS_TO_HOURS; % [h]