Filter löschen
Filter löschen

Reshape error when converting 2D to 3D data

1 Ansicht (letzte 30 Tage)
edward kabanyas
edward kabanyas am 16 Nov. 2020
Kommentiert: edward kabanyas am 16 Nov. 2020
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 Kommentare
Sulaymon Eshkabilov
Sulaymon Eshkabilov am 16 Nov. 2020
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 am 16 Nov. 2020
Size of data1 is 1751600x200

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 16 Nov. 2020
xxx78*2 is going to end in 56 not in 16. The size should be 8758 not 8578

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by