Question: Creating a diagonal matrix with values from a vector.

Suppose we have a column vector B of n elements. Whats the simplest code for creating n x n Matrix A whose off diagonal elements are 0 and whose diagonal elements are the elements of B?
Please Wait...