How to find the occurrence of an element in a column of a table
3 views (last 30 days)
Show older comments
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'
0 Comments
Accepted Answer
dpb
on 2 May 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...
More Answers (0)
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!