I have problem for reshape 1d matrix (C1d(340029,1)) to 3d matrix (D3d(?,215,395)), Thank you for any help.
>> Error using reshape
>> Product of known dimensions, 84925, not divisible into total number of elements, 340029.
M = 215,
L = 395,
M*L = 215*395 = 84925,
C1d(340029,1),
D3d=reshape(C1d,[],M,L);

댓글 수: 1

Adam
Adam 2019년 5월 3일
340029 is neither divisible by 215 or 395 so how are you expecting it to reshape to that size?

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2019년 5월 3일

1 개 추천

This cannot work. There is no number, which satisfies 340029 = X * 215 * 395 , but reshape does not change the number of elements.
Farshid Daryabor
Farshid Daryabor 2019년 5월 4일

0 개 추천

Actually "A(N=31,M=215,L=395)" is a 3d Matrix, converted to 1d Matrix "A1(N*M*L,1)"
I'm trying to find the values between 10-30 from the "K" matrix to index it for the "A1".
iz=find(K>10 & K<30);
C1d=A1(iz);
Then convert "C1d" to 3d "D3d".

댓글 수: 1

Walter Roberson
Walter Roberson 2019년 5월 4일
The only time that can work is if the number of items in iz is divisible by 84925, which you cannot guarantee unless you know more about the K matrix.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2019년 5월 3일

댓글:

2019년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by