separating non empty array
조회 수: 3 (최근 30일)
이전 댓글 표시
i'm noob to matlab, I have a matrix of 1764 x1 this was concatenated from 2 images how can i create a new matrix where it will automatically split into 2 columns of 882 x2?
example
b=[b;c] % this give me 1764 x 1
i tried
c=[c,b] but it will only give me 882 x1 double instead of 882 x 2
any expert advise is greatly appreciated.
댓글 수: 2
per isakson
2014년 9월 5일
편집: per isakson
2014년 9월 5일
You are using the letters a, b and c in a confusing way! Is a in the second line the same as a in the first?
답변 (2개)
dpb
2014년 9월 5일
a=[b c];
The ';' caused vertical concatenation; a ',' or space is horizontal. Read the "Getting Started" section on basic manipulations in Matlab...
There's a tutorial link on 'Matrices and Arrays' under which is another link specifically on 'Concatenation'. I urge you to just begin at the beginning and work thru the tutorial info to get a handle on the basics...it'll be much quicker route than posting and waiting...
per isakson
2014년 9월 5일
편집: per isakson
2014년 9월 5일
"what i'm trying to do now is to split this 1764 x 1 into 884 x 2 double"
This does it
long_vector = linspace( 1, 12, 1764 ); % sample vector
two_row_array = reshape( long_vector, [], 2 );
and check the result
>> whos
Name Size Bytes Class Attributes
long_vector 1x1764 14112 double
two_row_array 882x2 14112 double
The word "split"  is not a good one to describe this operation. And don't forget dpb's advise regarding Getting Started.
 
Correction
The name, two_row_array, should be two_col_array
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!