converting matrix to array

조회 수: 31 (최근 30일)
Terry McGinnis
Terry McGinnis 2015년 6월 23일
편집: Stephen23 2015년 6월 23일
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?

답변 (1개)

Stephen23
Stephen23 2015년 6월 23일
편집: Stephen23 2015년 6월 23일
>> 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

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by