COnvert 3d matrix to 2D
조회 수: 6(최근 30일)
표시 이전 댓글
I have a matrix of x=1200x30x410, i need to change it to 2D as x=3600x410. How to do that.?
it gives an error by using reshape that 'Product of known dimensions, 410, not divisible into total number of elements, 3672000'
댓글 수: 0
답변(1개)
Star Strider
2019년 12월 5일
The reshaped matrix has to be (36000 x 410).
x = rand(1200,30,410); % Create Matrix
y = reshape(x,[],410);
You can reduce the first dimension afterwards, if necessary.
댓글 수: 2
Star Strider
2019년 12월 5일
Please define ‘doesn’t work’.
It works for me:
D = load('matlab.mat');
x = D.x;
y = reshape(x, [], 102);
whos('y')
producing:
Name Size Bytes Class Attributes
y 6000x102 4896000 double
참고 항목
범주
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!