If Statement Using Text in a Table

6 vues (au cours des 30 derniers jours)
Jay
Jay le 21 Juil 2019
Commenté : Walter Roberson le 23 Juil 2019
What commands can I use in the following if statement to specify blank element overwrite?
% Run throught the table of 10 rows
for i = 1:10
% The word "REMOVE" has been used in a previous condition subroutine to specify the row removal in this if statment
if strcmp("REMOVE",table1(i,1)) == 1
% Emptys rows
table1(i,:) = []
else
end
end
The subroutine is executed and the table rows are not being emptied when true

Réponse acceptée

madhan ravi
madhan ravi le 21 Juil 2019
T=table({'asdsa';'REMOVE'}); % example
idx=strcmp(T{:,1},"REMOVE");
T(idx,:) = [] % remove those rows
  14 commentaires
Jay
Jay le 23 Juil 2019
Thank you for explaining what that command does Walter.
The explanations by the more advanced contributors help a lot more in understanding commands that exceed the simpler commands in the Matlab documentation.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tables 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!

Translated by