フィルターのクリア

Issues with intersect function

2 ビュー (過去 30 日間)
Davin
Davin 2014 年 11 月 17 日
回答済み: suren 2018 年 5 月 22 日
Hello,
I am using intersect function with this following command :
[c, ia ib] = intersect(Signal,VIndex)
VIndex = [VIndex(ib,1),VIndex(ib,2)]
>> size(Signal)
ans =
2514 2
>> size(VIndex)
ans =
2517 2
The problem with this, is that i am getting this following error :
Index exceeds matrix dimensions.
the issue is that the command that my ib is giving me something like this in the first columns :
2572
4004
4
5
6
7
8
9
10
I would expect it to start with 4 and not the first 2 rows, thats why i am getting this error.
I removed the first 2 columsn manually, and it works well. But when executed, it keeps putting these 2 numbers in the first 2 rows...
Anyone encountered this?
Thank you
D
  1 件のコメント
dpb
dpb 2014 年 11 月 17 日
Unless it's been changed, the above shouldn't even work at all; w/ R2012b for two arrays w/o the 'rows' optional argument I get
>> a=randi(4,3,2);b=randi(4,5,2);
>> [c,ia,ib]=intersect(a,b)
Error using intersect>intersectlegacy (line 173)
A and B must be vectors, or 'rows' must be specified.
Error in intersect (line 90)
[varargout{1:nlhs}] = intersectlegacy(varargin{:});
>>
That you "removed the first 2 columns manually" (albeit unspecified which two I presume means the first from each of the two input arrays??) I'd expect it to function correctly.
As is, I've no idea what a current release does; doc doesn't indicate anything different. It indicates that ia, ib are vectors.

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

採用された回答

suren
suren 2018 年 5 月 22 日
Probably you have used 'intersect' as a variable prior. Because I had the same issue and I searched my way to this thread. LOL. I rectified mine. I hope it helps someone in the future. Clear variable 'intersect'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by