How to construct a vector from specific elements in a matrix

19 Ansichten (letzte 30 Tage)
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])

Akzeptierte Antwort

Birdman
Birdman am 20 Sep. 2018
B=[A(1,2);A(2,3);A(3,1)]

Weitere Antworten (1)

Stephen23
Stephen23 am 20 Sep. 2018
Bearbeitet: Stephen23 am 20 Sep. 2018
With linear indexing:
B = A([4,8,3])

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by