Using the Correct Product with MATLAB for Dummies

A reader recently wrote in with a problem with the example on pages 311 and 312 of MATLAB for Dummies. In this case, the reader was using the R2015b academic license edition. What the reader saw was this error:

>> A = magic(4)

A =

    16     2     3    13
    5    11    10     8
    9     7     6    12
    4    14    15     1

>> factor(sym(A))
Error using sym/factor (line 50)
The first argument must be a scalar.

It turns out that the newer version of MATLAB doesn’t provide the same support as the R2013b release used for the book. As a result, the example code doesn’t work as expected because the newer version requires different code that looks like this:

A=magic(4)
for i=1:4
    for j=1:4
        B{i,j}=factor(A(i,j));
    end
end

To get all factors double click on B in the workspace window. This workaround is needed because the newer version no longer supports the old method of performing the task.

The point is that the book is written to use a specific version of MATLAB, R2013b, so you must have that version in order to get good results. Fortunately, you can still get the R2013b release. All you need to do is go to the Mathworks site at: http://www.mathworks.com/downloads/select_release. Simply choose the R2013b release from the Download Earlier Release list after you have logged in. Please let me know if you have any questions or concerns at John@JohnMuellerBooks.com.