How to delete elements which in cell?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
vx2008
el 24 de Dic. de 2015
Comentada: vx2008
el 25 de Dic. de 2015
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!
Respuesta aceptada
Jan
el 24 de Dic. de 2015
[indexA, indexB] = ismember(DataA{1}, DataB{1});
DataA{1}(indexA) = [];
DataA{2}(indexA) = [];
DataB{1}(indexB) = [];
DataB{2}(indexB) = [];
See also: setdiff.
Más respuestas (0)
Ver también
Categorías
Más información sobre Map Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!