converting matrix to array

31 Ansichten (letzte 30 Tage)
Terry McGinnis
Terry McGinnis am 23 Jun. 2015
Bearbeitet: Stephen23 am 23 Jun. 2015
Is there a way to convert a n x n matrix into a n^2 x 1 array,such that all the elements in the array(or horizontal vector) appear in row major format?

Antworten (1)

Stephen23
Stephen23 am 23 Jun. 2015
Bearbeitet: Stephen23 am 23 Jun. 2015
>> A = randi(9,3)
A =
1 7 1
1 3 4
8 9 4
>> reshape(A.',1,[])
ans =
1 7 1 1 3 4 8 9 4

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by