Filter löschen
Filter löschen

reshape problem in matlab

4 Ansichten (letzte 30 Tage)
evangeline
evangeline am 22 Jan. 2014
Kommentiert: evangeline am 22 Jan. 2014
I have a 2D matrix, which is: h=zeros(65536,1); now when I use the: h = reshape(h, 256, 256); i get the error: To RESHAPE the number of elements must not change. but the number of elements are the same on both matrixes, what should I do?

Akzeptierte Antwort

the cyclist
the cyclist am 22 Jan. 2014
This code works for me just fine:
h = zeros(65536,1)
h = reshape(h, 256, 256);
Are you 100% sure you are not doing something in between those two lines that changes the shape of h? I suggest you insert the line
N = numel(h)
just before you do the resize, just to be sure.
  1 Kommentar
evangeline
evangeline am 22 Jan. 2014
so I guess I should check my code, thanks

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by