To RESHAPE the number of elements must not change.

6 Ansichten (letzte 30 Tage)
Ramesh Bala
Ramesh Bala am 21 Aug. 2019
Kommentiert: Ramesh Bala am 21 Aug. 2019
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 Kommentar
Rik
Rik am 21 Aug. 2019
You are asking Matlab to put 172975104 elements in an array with 207360000 elements. What do you want to happen?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Guillaume
Guillaume am 21 Aug. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by