CAT arguments dimensions are not consistent

Hi I am getting the following error :
*??? Error using ==> horzcat
CAT arguments dimensions are not consistent.*
But I am pretty sure that the dimensions are consistent. Please see below:
>> fn_trades = horzcat(trades.textdata(2:length(trades.textdata),1:2), trades.data(1:length(trades.data),1:2))
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
>> size(trades.textdata(2:length(trades.textdata),1:2))
ans =
1927 2
>> size(trades.data(1:length(trades.data),1:2))
ans =
1927 2
As you can see, the sizes of the two vectors are the same. So horizontal concatenation should work ??
Any ideas ?

3 件のコメント

Matt J
Matt J 2013 年 10 月 29 日
編集済み: Matt J 2013 年 10 月 29 日
Attach "trades" in a .mat file so that we can try to reproduce it.
Werner
Werner 2013 年 10 月 29 日
OK, found the answer. The first argument produces two text columns, while the second gives numeric. So it doesn't want to cat.
This works (note the num2cell):
fn_trades = [trades.textdata(2:length(trades.textdata),1:2) num2cell(trades.data(1:length(trades.data),1:2))]
Matt J
Matt J 2013 年 10 月 29 日
That wouldn't account for a dimension mismatch error. You can cat char with double, e.g.,
>> ['aa' 66,67]
ans =
aaBC

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

回答 (0 件)

カテゴリ

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

タグ

質問済み:

2013 年 10 月 29 日

コメント済み:

2013 年 10 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by