3.3. Entering Data in Matrices

The following points are to be noted for entering an explicit list of matrix elements at the Command Window:

  • Start with a left-handed square bracket ‘[’.

  • Type the matrix elements row wise. Each row vector should have the same length to create a valid matrix.

  • Enter the elements of the first row with one or more blanks or a comma separating each element.

  • Separate the different rows of the matrix by a semicolon (;) or a carriage return.

  • Enclose the entire list of elements of the matrix with in square brackets, that is [ ].

  • Elements of a matrix can be a real number, complex number or a valid MATLAB expression (provided that the values of unknown variables in the expression are supplied before the execution of the expression). ...

Get MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.