Setdiff n intersect question
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hi,
I have two dataset.
1)
- Shop# - floor#
- 321 - 4
- 321 - 2
- 321 - 3
- 322 - 0
- 322 - 2
2)
- shop# - floor#
- 322 - 1
- 322 - 0
- 322 - 2
if i do intersect of those two, i expect following, but i get just first row. WHy? 3)
- shop# - floor#
- 322 - 0
- 322 - 2
採用された回答
Guillaume
2014 年 8 月 21 日
>> a=[321 4;321 2;321 3;322 0;322 2];
>> b=[322 1;322 0;322 2];
>> intersect(a, b, 'rows')
ans =
322 0
322 2
8 件のコメント
Neesha
2014 年 8 月 21 日
With 'rows' i get following error
Error using getvarindices (line 25) Unrecognized variable name 'rows'.
Error in dataset/intersect (line 47) avars = getvarindices(a,vars,false);
Matt J
2014 年 8 月 21 日
Check for typos, e.g., not enclosing 'rows' in quotes. You should be able to verify by direct copy/paste that Guillaume's code works as shown.
Neesha
2014 年 8 月 21 日
i did. Something is wrong with 322, 2 entry. When i type the set in from commandline, it works with 'rows'. When i convert my program data into double and try it with 'rows' it returns only '322, 0' and not the second line ..:(
Guillaume
2014 年 8 月 21 日
Can you paste your program here, then?
Otherwise, it's difficult to say what's wrong with it.
Neesha
2014 年 8 月 21 日
yes i understand....but i think i figured. My format was set to shortG so one 2 is 2.995 and the other is 2 i will make take the 'floor' n see if that helps if it does not, i will paste the code
Neesha
2014 年 8 月 21 日
ok, so i had to round floor number to get it to work... thanks.
Matt J
2014 年 8 月 22 日
@Neesha, if you got it work, you should accept Guillaume's answer

Neesha
2014 年 8 月 22 日
i accepted it, but i did not end up using 'rows', it worked without it as problem was coming from somewhere else
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Numeric Types についてさらに検索
タグ
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
