How to compare two columns in a table and delete that row having same values in that columns?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
column1 column 2 columns3
ball bat gloves
bat gloves bat
ball gloves ball
Mow if I compare column1 and column3, I want to remove the rows having same values in that row of the columns
0 commentaires
Réponses (2)
dpb
le 12 Avr 2021
c=string({'column1' 'column 2' 'columns3'
'ball' 'bat' 'gloves'
'bat' 'gloves' 'bat'
'ball' 'gloves' 'ball'});
c=c(c(:,1)~=c(:,3),:);
returns
>> c
c =
2×3 string array
"column1" "column 2" "columns3"
"ball" "bat" "gloves"
>>
I kept the header row to have something else in the array as a result...
0 commentaires
Sanwal Zeb
le 18 Avr 2021
1 commentaire
dpb
le 18 Avr 2021
Well, we'll have to see what you really have to write actual syntax...we can't see your workspace from here...
Voir également
Catégories
En savoir plus sur String Parsing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!