How to find the occurrence of an element in a column of a table

14 vues (au cours des 30 derniers jours)
Cem Akinci
Cem Akinci le 2 Mai 2022
Commenté : Cem Akinci le 2 Mai 2022
I have a CSV file as shown below and i used readtable function to read it into a table in Matlab. There are several test cases and I need to count the total number of 'Passed' and 'Failed' test cases. I'm a bit stuck and don't know how to proceed.
TestCase Duration Status
__________________________________________________________ ______________ ________
'...................................' '5.1 sec' 'Passed'
'...................................' '2.4 sec' 'Failed'

Réponse acceptée

dpb
dpb le 2 Mai 2022
tYourTable.Status=categorical(tYourTable.Status); % more convenient thatn cellstr() in use
tCounts=groupsummary(tYourTable,'Status')
Look at the available functions from the link "Functions" at the top of the doc page for the table object -- it's a gold mine of how to process table data...

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