array to vector conversion
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a 3-dimensional array A which has 450 rows,210 coulms, 4 layers. I want to make a regression between A(450,210,1) and A(450,210,3), A(450,210,2) and A(450,210,4). For that I need to convert the array to 4 vecotrs. I don't know how to do that. I tried Reshape function but couldn't get what I want. Any help is appericiated.
댓글 수: 0
채택된 답변
Oleg Komarov
2011년 4월 15일
A = rand(450,210,4);
EDIT
% Switch 2nd dim with 1st
A = permute(A,[2,1,3]);
% Reshape into vector each layer
A = reshape(A,450*210,4)
Each column now is the vectorized layer.
댓글 수: 6
James Tursa
2011년 4월 17일
Type the following at the MATLAB command line prompt:
mex -setup
Then press Enter
Then enter the number of a C compiler such as lcc
Then press Enter again
Then try running mtimesx again.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!