Filter löschen
Filter löschen

Combine/join table based on common names

4 Ansichten (letzte 30 Tage)
Mohammed Kamruzzaman
Mohammed Kamruzzaman am 21 Apr. 2015
Kommentiert: Star Strider am 21 Apr. 2015
I have two tables with sting and their length is different. I want to make a table with common string;
CSN_PROV1_20130209 CSN_PROV1_20130209
CSN_WADC1_20131004 CSN_WADC1_20131004
CSN_PROV1_20130320 CSN_PROV1_20130320
CSN_WADC1_20131203 CSN_WADC1_20130430
CSN_BEHI1_20130127 CSN_PROV1_20131111
CSN_BEHI1_20130127
I want my new table as:
CSN_PROV1_20130209
CSN_WADC1_20131004
CSN_PROV1_20130320
CSN_BEHI1_20130127

Akzeptierte Antwort

Star Strider
Star Strider am 21 Apr. 2015
I had to reconstruct your arrays so they would work. I believe the intersect output is what you want, but I listed the unique output as well:
T1 = ['CSN_PROV1_20130209'
'CSN_WADC1_20131004'
'CSN_PROV1_20130320'
'CSN_WADC1_20131203'
'CSN_BEHI1_20130127'];
T2 = ['CSN_PROV1_20130209'
'CSN_WADC1_20131004'
'CSN_PROV1_20130320'
'CSN_WADC1_20130430'
'CSN_PROV1_20131111'
'CSN_BEHI1_20130127'];
Tu = unique([T1; T2], 'rows') % Unique Elements
Ti = intersect(T1, T2, 'rows') % Intersecting Elements
producing:
Tu =
CSN_BEHI1_20130127
CSN_PROV1_20130209
CSN_PROV1_20130320
CSN_PROV1_20131111
CSN_WADC1_20130430
CSN_WADC1_20131004
CSN_WADC1_20131203
Ti =
CSN_BEHI1_20130127
CSN_PROV1_20130209
CSN_PROV1_20130320
CSN_WADC1_20131004
Apologies for the delay — we had an inundation of Korean spam tonight, and I was busy deleting it.
  2 Kommentare
Mohammed Kamruzzaman
Mohammed Kamruzzaman am 21 Apr. 2015
Thank you so much Star Strider. Your answer is perfect and awesome.
Star Strider
Star Strider am 21 Apr. 2015
My pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by