horzcat CAT arguments dimensions are not consistent.

I have problem with my code.
??? Error using ==> horzcat CAT arguments dimensions are not consistent.
Error in ==> rozpoznawanie_dzwiekowPerc at 209 mfcc_kaszel = [mfcc_kaszel; [c sp_bw sp_centroid sp_rolloff shortte zerocr]];

1 件のコメント

AJ von Alt
AJ von Alt 2014 年 1 月 21 日
Can you post your code? Make sure that each vector your are trying to concatenate has the same number of rows. Errors like this usually happen when you try to concatenate a row vector with a column vector.

サインインしてコメントする。

 採用された回答

Image Analyst
Image Analyst 2014 年 1 月 22 日

0 投票

I'm not sure if you want an 82 row by 18 column array as the output, or a 18 row by 82 column array, so here is how to do it both ways:
% Define sample data for testing.
mfcc_kaszel = [];
c = ones(82,13);
shortte = ones( 82,1);
sp_bw = ones( 1,82);
sp_centroid = ones(1,82);
sp_rolloff = ones( 1,82);
zerocr = ones(82,1);
% Make 82 row by 18 column matrix.
mfcc_kaszel = [mfcc_kaszel; [c, sp_bw', sp_centroid', sp_rolloff', shortte, zerocr]];
% Make 18 row by 82 column matrix.
mfcc_kaszel2 = [c'; sp_bw; sp_centroid; sp_rolloff; shortte'; zerocr'];

5 件のコメント

Monika
Monika 2014 年 1 月 25 日
What's wrong?
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
Error in ==> rozpoznawanie_dzwiekowP at 211
mfcc_krzyk = [mfcc_krzyk; [c, sp_bw', sp_centroid', sp_rolloff',
shortte, zerocr]];
Image Analyst
Image Analyst 2014 年 1 月 25 日
Like I said, I'm not sure what you want, so try it the second way I showed you.
% Make 18 row by 82 column matrix.
mfcc_kaszel = [c'; sp_bw; sp_centroid; sp_rolloff; shortte'; zerocr'];
Monika
Monika 2014 年 1 月 28 日
I think that I know where is the problem. The problem is that the dimensions of sp_bw, sp_centroid and sp_rolloff, c shortte and zerocr aren't the same dimencions. I don't know why program showed before something different.
K>> size(mfcc_kaszel)
ans =
82 18
K>> size(c)
ans =
51 13
K>> size(sp_centroid')
ans =
51 1
K>> size(shortte)
ans =
51 1
K>> size(zerocr)
ans =
51 1
K>> size(sp_bw')
ans =
82 1
K>> size(sp_rolloff')
ans =
82 1
Image Analyst
Image Analyst 2014 年 1 月 28 日
So I think you'd better track down why the sizes are not at all what you expect.
Monika
Monika 2014 年 1 月 28 日
If I ignore sp_bw sp_rolloff. My program works. But how can I add sp_bw and sp_rolloff ?

サインインしてコメントする。

その他の回答 (1 件)

Amit
Amit 2014 年 1 月 21 日

0 投票

The problem is in
[mfcc_kaszel; [c sp_bw sp_centroid sp_rolloff shortte zerocr]]
[c sp_bw sp_centroid sp_rolloff shortte zerocr] is a 1x3 matrix. Unless mfcc_kaszel is nx3 matrix this operation in not allowed.
what is the dimension of mfcc_kaszel?

3 件のコメント

Amit
Amit 2014 年 1 月 21 日
Once you have run this code and got the error, do the following and post your result.
whos mfcc_kaszel c sp_bw sp_centroid sp_rolloff shortte zerocr
Monika
Monika 2014 年 1 月 21 日
My result:
Name Size Bytes Class Attributes
c 82x13 8528 double
mfcc_kaszel 0x0 0 double
shortte 82x1 656 double
sp_bw 1x82 656 double
sp_centroid 1x82 656 double
sp_rolloff 1x82 656 double
zerocr 82x1 656 double
Amit
Amit 2014 年 1 月 22 日
The problem is that the dimensions of sp_bw, sp_centroid and sp_rolloff are 1x82 while the same for c, shortte and zerocr are 82xn. mfcc_kaszel is a null vector so it doesn't matter.
I think you need to change the code like this:
mfcc_kaszel = [mfcc_kaszel; [c sp_bw' sp_centroid' sp_rolloff' shortte zerocr]];
which will work.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2014 年 1 月 21 日

コメント済み:

2014 年 1 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by