MATLAB Tips and Resources
- Matlab is case sensitive.
- Think about whether your variables are scalars, vectors, or matrices.
- Variable names, and m-files names, cannot start with a number.
- Matlab may not like file names with a space in them, so avoid them.
- While Matlab can deal with "HOURS" and "hours" as two different
variables (because it is case sensitive), you may not be so lucky, so I
would never use those two variables in the same program.
- Use the Workspace, which lists all the variables. You can click on
one, and see a table showing the values, and you can compare what Matlab is
computing (based on your code) with what you know it should be.
- If you use functions in external files, you should not rename them.
- Matlab, like most languages, has two kinds of "equal". These often
have different symbols (in Matlab, they are "==" and "=").
- Boolean equality. This tests whether two variables are the same.
- Replace. This takes whatever is in a current memory location, and
replaces it with a new value. This is what we mean with something like
x = x + 1;
Student resources from Mathworks
The web has a host of resources for Matlab. Try googling whatever you
need (use "MATLAB" and then a term that describes what you want to do). I have found the following sites useful:
SM415 and SM415H websites have links to other Matlab resources
SEA-MAT: Matlab Tools for Oceanographic Analysis
last revised 1/22/2013