Variables & Constants
Variables should not be reused unless required by memory limitation
Variables should not be reused unless required by memory limitation
Enhance readability by ensuring all concepts are represented uniquely. Reduce chance of error from misunderstood definition.
Related variables of the same type can be declared in a common statement; unrelated variables should not be declared in the same statement
Related variables of the same type can be declared in a common statement; unrelated variables should not be declared in the same statement
It enhances readability to group variables.
persistent x, y, z
global REVENUE_JANUARY, REVENUE_FEBRUARY
Consider documenting important variables in comments near the start of the file
Consider documenting important variables in comments near the start of the file
It is standard practice in other languages to document variables where they are declared. Since MATLAB does not use variable declarations, this information can be provided in comments.
% pointArray Points are in rows with coordinates in columns.
Consider documenting constant assignments with end of line comments
Consider documenting constant assignments with end of line comments
This gives additional information on rationale, usage or constraints.
THRESHOLD = 10; % Maximum noise level found by experiment.