MATLAB Answers

0

How to construct a vector from specific elements in a matrix

Asked by Lauren Fletcher on 20 Sep 2018
Latest activity Edited by Stephen Cobeldick on 20 Sep 2018
Given the matrix A = [3 4 7; 8 2 1; 6 0 9], how would I create a vector that is composed of the first row second column, second row third column and third row first column of matrix A (ie B = [4; 1; 6])

  0 Comments

Sign in to comment.

Products


Release

R2018a

2 Answers

Answer by Birdman
on 20 Sep 2018
 Accepted Answer

B=[A(1,2);A(2,3);A(3,1)]

  0 Comments

Sign in to comment.


Answer by Stephen Cobeldick on 20 Sep 2018
Edited by Stephen Cobeldick on 20 Sep 2018

With linear indexing:
B = A([4,8,3])

  0 Comments

Sign in to comment.