How can I delete data from a variable in a table?
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Waleed Nowayti
el 23 de Jul. de 2021
Comentada: Waleed Nowayti
el 3 de Ag. de 2021
How can I delete data from a variable in a table: For example,
I want to delete all rows that has 'Not Collected' under SampledDate.

4 comentarios
Respuesta aceptada
Sulaymon Eshkabilov
el 24 de Jul. de 2021
In fact, it is not viable to delete only rows as dpb stated.
Otherwise, if you'd like to remove all elements of specific rows, that can be done relatively easy, e.g.:
TAB(TAB.SampledDate=='Not Collected', :)=[];
8 comentarios
Stephen23
el 3 de Ag. de 2021
"In general, what is the different between these two ways?"
One checks if the table data contains the required text, the other checks if the table data is the same as that text.
"Why is it giving the same output and will they be different outputs if they are used in a different code?"
Just like any functions, they will give different outputs depending on the input data:
A = 'cat in hat';
B = 'hat';
contains(A,B)
strcmp(A,B)
Only you (as your code's author) can decide which one suits your needs best.
Más respuestas (0)
Ver también
Categorías
Más información sobre Tables 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!