| General Coding Practices A few suggested programming practices: • Use descriptive function and variable names to make your code easier to understand. • OrdersubfunctionsalphabeticallyinanM-filetomakethemeasiertofind. • Precede each subfunction with a block of help text describing what that subfunction does. This not only explains the subfunctions, but also helps to visually separate them. • Do not extend lines of code beyond the 80th column. Otherwise, it will be hard to read when you print it out. • Use full Handle Graphics® property and value names. Abbreviated names are often allowed, but can make your code unreadable. They also could be incompatible in future releases of MATLAB. Naming a Function Uniquely To avoid choosing a name for a new function that might conflict with a name already in use, check for any occurrences of the name using this command: which -all functionname For more information: See the which function reference page. |