필터 지우기
필터 지우기

Reshape error when converting 2D to 3D data

조회 수: 1 (최근 30일)
edward kabanyas
edward kabanyas 2020년 11월 16일
댓글: edward kabanyas 2020년 11월 16일
I want to convert 2D data to 3D.
Currently I use :
ij=0;
for ix=1:200:size(data1,1)
ij=ij+1;
data(ij,:,:)=data1(ix:ix+199,:);
end
However it is very slow. I try the following code then:
permute(reshape(data1, 200, 8578, 200), [1 3 2]);
But, I get the following error:
Error using reshape
To RESHAPE the number of elements must not change.
Size of data1 is 1751600x200.
Thank you for help.
  댓글 수: 2
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 11월 16일
what is the size of the variable called: data1?
It looks like you have a sizing problem while converting your 2D variable into 3D one.
edward kabanyas
edward kabanyas 2020년 11월 16일
Size of data1 is 1751600x200

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

답변 (1개)

Walter Roberson
Walter Roberson 2020년 11월 16일
xxx78*2 is going to end in 56 not in 16. The size should be 8758 not 8578
  댓글 수: 1
edward kabanyas
edward kabanyas 2020년 11월 16일
yes, you are correct, the size should be 8758 not 8578

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

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by