To RESHAPE the number of elements must not change.

조회 수: 6 (최근 30일)
Ramesh Bala
Ramesh Bala 2019년 8월 21일
댓글: Ramesh Bala 2019년 8월 21일
rows = 450;
cols = 450;
samples = 1024;
samples = size(data2d,2);
Data = reshape(data2d,cols,rows,samples);
Data = flip(Data,1);
I have the data2d of 168921*1024
It gives me reshape error ??
  댓글 수: 1
Rik
Rik 2019년 8월 21일
You are asking Matlab to put 172975104 elements in an array with 207360000 elements. What do you want to happen?

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

채택된 답변

Guillaume
Guillaume 2019년 8월 21일
Well, yes as the error message says, the number of elements must no change. You tell us that currently data2 has 168921 (* 1024) elements and want to reshape to 450*450 (* 1024) = 202500 (* 1024) elements. 202500 is not equal to 168921, so indeed you can't reshape.
You need to choose a different shape or change your input so that it has the same numbers of element as your desired shape.
  댓글 수: 1
Ramesh Bala
Ramesh Bala 2019년 8월 21일
Yes you are correct. I changed it to 411*411 and it works

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by