|
|
|
|
|
Variables
How to Examples How to: Variables, in MATLAB, work just like variables would on paper. They start out having no value at all. To give them an initial value, we pick a variable name, put an '=' sign and give it a value. We can change a variable's value at any time by typing its name, an '=' sign, and putting its new value. You are not limited to single-letter variables in MATLAB as we sometimes limit ourselves to on paper. MATLAB variable names need only follow a few guidelines: 1) Variables names must BEGIN with a letter 2) After that, they may contain any combination of letters, numbers, and underscores ( _ ) 3) NO SPACES are allowed in a variable's name 4) Names are CASE-sensitive. So, 'HEIGHT' is a completely different variable than 'height'. 5) Names may only be up to 31 characters in length (MATLAB will ignore anything after that) Examples: The following variable names are all acceptable (and unique) in MATLAB: Height_Of_Tree, R2D2, x7483738282, ThisIsThirtyOne31CharactersLong, ABC123, abc123, AbC123 The following variable names are not acceptable (or will be truncated after 31 characters): %increase, My Age, 10_year_profit, This_Is_Thirty_Two_32_Characters, BankAccount$ |