MATLAB is an incredibly versatile mathematics and engineering tool, capable of advanced calculations and engineering simulations. A simple function of MATLAB is to store a list of numbers in what it calls an array. You can define the array values automatically through a function or assign them one-by-one directly. MATLAB stores matrices internally as arrays, appended row after row. The program refers to each spot in the array as an "element" and refers to the m-th element in array "A" as "A(m)."
- Skill level:
- Moderately Easy
Other People Are Reading
Define an array, using any method. For example, "A = [1 2 3 4]" creates an array of four elements with the numbers 1, 2, 3 and 4.
Insert a value into an array by typing "A(m) = value" where "A" is the matrix name, "m" is which element, sequentially, you want to define and "value" is the number you want the "m-th" element in "A" to have.
Note that following these steps and using step one's matrix "A," "A(2) = 5" causes MATLAB to output the following:
1 5 3 4
Notice that MATLAB changed the 2nd element in "A" to a 5.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for