Matrix Manipulations 1 (extracting elements for new matrices) E
32 ビュー (過去 30 日間)
古いコメントを表示
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.
回答 (1 件)
Sanket Karnik
2017 年 2 月 15 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!