How to delete elements which in cell?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Now I have DataA and DataB as below:
DataA =
{5x1 cell} [5x1 double]
DataB =
{5x1 cell} [5x1 double]
DataA{1} =
'2015/05/04'
'2015/05/05'
'2015/05/06'
'2015/05/08'
'2015/05/09'
DataB{1}=
'2015/05/04'
'2015/05/05'
'2015/05/06'
'2015/05/07'
'2015/05/08'
DataA{2} =
1.0e+03 *
4.4413
4.4799
4.3116
4.1979
4.1530
DataB{2} =
17.2400
16.9700
16.3200
16.2700
16.4300
Now I want to find the difference between DataA{1} and DataB{1} first; then delete the different rows in DataA and DataB; For example, DataA{1} has '2015/05/07' which DataB{1} doesn't have; so DataA{1}(4) and DataA{2}(4) should be deleted; and the same other different points.
My question is how to do this?
thank you!
Réponse acceptée
Jan
le 24 Déc 2015
[indexA, indexB] = ismember(DataA{1}, DataB{1});
DataA{1}(indexA) = [];
DataA{2}(indexA) = [];
DataB{1}(indexB) = [];
DataB{2}(indexB) = [];
See also: setdiff.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Map Display 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!