eldamar
Newbie level 5
- Joined
- Apr 24, 2014
- Messages
- 10
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 3
- Activity points
- 68
Hi everyone. I am trying to write matlab programme for audio compression using DCT method. Here, I posted some of the my code.
....
Matlab gives such an error when I try to execute this programme and I didn't understand why.Can you help me to fix this error,please? ( By the way, my wav file has 3379968 elements I found it with using numel(). )
Code:
%function result = compress_dct(X, window, num_components, coeff_bits)
[X1 , f ]=wavread('samplepiano.wav');
window=35208;
num_components=100;
coeff_bits=10;
num_win = 48;
%new=numel(X1);
%disp(new);
X = reshape(X1, window, num_win); % reshape so each window is a row
Y = dct(X); % applies dct to each row
[a, I] = sort(abs(Y), 'descend');
I = I(1:num_components, :);
Matlab gives such an error when I try to execute this programme and I didn't understand why.Can you help me to fix this error,please? ( By the way, my wav file has 3379968 elements I found it with using numel(). )
Error using reshape
To RESHAPE the number of elements must not change.
Last edited by a moderator: