Skip to main content

Section 11.4 MATLAB Functions for Working With Arrays

As mentioned in the previous chapter, arrays are the fundamental way to store data in MATLAB. Fun fact: a scalar in MATLAB is actually just stored as a 1x1 array!
Because arrays are so fundamental to the way that MATLAB operates, MATLAB comes pre-packaged with several functions that can perform analysis on arrays. A non-comprehensive (but useful) list of these functions is presented in the table below.
To learn these, I suggest that you create a new section of your chapter10_examples.m script, and practice them on the 4 Workspace variables (mat1,mat2,vec1,vec2) that we have been using this chapter. Don’t forget to read the help text on these functions as well as it can be very helpful!
In table 11.4.1, A is considered an array (don’t forget an array can be a vector or a matrix).
Figure 11.4.1. A collection of functions that work specifically on arrays.
Note: some of the functions above work a little differently on matrices than on vectors. For example) in the command window type help std, read the help text introductory paragraph, then answer the following question.
For this question, consider a 5x8 matrix stored in the variable random_man with random values. When the user types in y = std(random_man) ...

Example 11.4.2 Exploring std on a Matrix.

Here is an interactive code box that functions identically to the MATLAB command window.

Checkpoint 11.4.3 Help! std.