MATLAB: Error using reshape To RESHAPE the number of elements must not change.

errorreshape

Hi everyone
cananyone help me please with the following error.
I'm getting the error "Error using reshape To RESHAPE the number of elements must not change."
windows=1;
wwf6=zeros(winsize,round(length(cleanAudio)/winsize));
pos=zeros(round(length(cleanAudio)/winsize));
for b=1:round(length(cleanAudio)/winsize)
pos(1)=1;
data1 = sig(pos(b): pos(b)+winsize-1).*(hamwin);
wwf6(:,b) = fft(data1);
windows = windows + 1;
pos(b+1) = pos(b) + winsize;
end
wwf6;
Y = reshape(wwf6,[length(cleanAudio),1]);

Best Answer

Must be same, see
Total Elements on wwf6=length(cleanAudio)*1
See the following example
>> A=magic(4)
A =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
Total Elements in A=16, if you trying to reshape A with following, it reflects the same error, because [5,1] having 5 elements only
>> reshape(A,[5,1])
Error using reshape
To RESHAPE the number of elements must not change.
But following have no issue, as [8,2]=16 elemnets equalt to original A
>> reshape(A,[8,2])
ans =
16 3
5 10
9 6
4 15
2 13
11 8
7 12
14 1
Hope it Helps!