I have two cell arrays and I want to compare which element from the first array has similar words in the second array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Prajwal Venkatesh
am 23 Jan. 2020
Beantwortet: Gaurav Garg
am 29 Jan. 2020
array1=
4×1 cell array
{'VRDU,2GA,M8XM8' }
{'CBL,NEG,2GA,M8 X M8F'}
{'people net,PWR DIST,VP'}
{'COVER, VPDM, BACK' }
array2= {'VRDU, (optional)' }
{'people-net antenna'}
Compare "each word" in the element (array1 {1,1}) in array1 with each word in element in array2 (array 2{1,1}) and if any one word is common amongst the elements display that element
For example "VRDU " is common in both array1 and array2 so display the corresponding element.
So I want the output to be =
{'VRDU,2GA,M8XM8' }
{'CBL,NEG,2GA,M8 X M8F'}
0 Kommentare
Akzeptierte Antwort
Gaurav Garg
am 29 Jan. 2020
Hi,
To solve your above problem, you can run a loop on array1 and another loop on array2 and use strcmp to compare both the cells.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!