Matrix Manipulations 1 (extracting elements for new matrices) E

The test suite generates a random M x N matrix with a random number of rows and columns that is assigned to the variable A . The element values of the matrix are random double precision numbers that fall in the range from -10 to 10. The matrix has between 5 and 10 rows and between 5 and 10 columns. Assuming A is defined in the workspace, write a script with commands to perform the operations described below and assign the results to the indicated variable names.
- Create a new 2 x N matrix, B, that consists of the first and last rows of A.
- Create a new 2 x 2 matrix, C, that consists of the elements at the four corners of A.
- Create a new M-1 x N-1 matrix, D, that consists of the second through last columns in the second through last rows of A.

Respuestas (1)

Sanket Karnik
Sanket Karnik el 15 de Feb. de 2017
I understand that you need help in indexing into a matrix. Please refer to the following link: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html
This article explains about how to index into a Matrix. The article also has many examples which will help you in understanding different types of indexing, which you can use to solve the question.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 7 de Feb. de 2017

Respondida:

el 15 de Feb. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by