Why does it give the error "Matrix dimensions must agree"??

1 view (last 30 days)
[y,Fs]=wavread('abc.wav'); y=y/(1.01*abs(max(y))); yy=buffer(y,909); N=909; w=window(@hamming,N); fnl=yy.*w;
  2 Comments
dpb
dpb on 19 Sep 2013
Cuz they don't??? :)
[y,Fs]=wavread('abc.wav');
y=y/(1.01*abs(max(y)));
yy=buffer(y,909);
N=909;
w=window(@hamming,N);
fnl=yy.*w;
Check what is
size(max(y))
??

Sign in to comment.

Accepted Answer

Jan
Jan on 19 Sep 2013
Perhaps the wav file is in stereo. Then abs(max(y)) is a vector and dividing y by this vector leads to this problem. Or perhaps yy and w do not have equal sizes, such that yy.*w must fail.
It would be useful if you post the complete error message, such that we do not have to guess, where the error occurs.
  3 Comments
Jan
Jan on 19 Sep 2013
@Rohit: No, "Matrix dimensions must agree" is not the complete message. When you want to discuss an error in the forum, post everything, which belongs to the error message, even if you do not know, if it matters.
You can check the sizes of yy and w by inserting this code:
size(yy)
size(w)
What do you see and what should yy .* w achieve then?
Rohit Deo
Rohit Deo on 20 Sep 2013
Got it Sir! The error is: ??? Error using ==> times Matrix dimensions must agree.
Error in ==> abc at 12 fnl=yy.*w;
Thank you Sir. size() has helped a lot to me. And now, what I've done is,
xy=yy(:,n); fnl=xy.*w;
Now it is working. As I was for n= 0 to (the number of frames i.e-82) Thank you Sir.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!